Write Rewrite rules for OpenLiteSpeed – CyberPanel

Write Rewrite rules for OpenLiteSpeed – CyberPanel

In this article, we are going to explore how to Write Rewrite rules for OpenLiteSpeed. If you have CyberPanel you can also do this using CyberPanel.

To write Rewrite rules, you first need to log in to your OpenLiteSpeed Webadmin Console with your credentials.

Then navigate to Virtual Hosts -> Rewrite -> Edit as shown in the image:

Make the following changes to the settings:

  • Enable Rewrite: Yes
  • Auto Load from .htaccess: Yes
  • Log Level: 9 (For maximum logs)

Click save and perform a graceful restart to apply changes.

We can do the same via CyberPanel, to do so type in the following URL and hit enter.


You will be presented with the CyberPanel webpage displaying the list of websites.

Managing website through CyberPanel

As you can see, I currently have one website the moment backlash.com. So, I will be going with it.

After choosing the website you want to write Rewrite rules for, click on the manage button as shown in the picture above.

Now keep scrolling down the page until you see the Configurations category.

Rewrite rules for OpenLiteSpeed

Now click on the vHost Conf.

As soon you click the vHost Conf, the current configurations from the file will be fetched.

rewrite  {
 enable                  1
  autoLoadHtaccess        1
rewriteFile        /home/backlash.com/public_html/.htaccess

Reading Rewrite rules from .htaccess file

Now let’s open the .htaccess file and check the rule written in a file.

### Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

### End CyberPanel Generated Rules.

cat: /home/backlash.com/public_html/.htaccess: No such file or directory

Any line starting with the pound symbol is a comment so, simply ignore them.

The rewrite rules execute after the RewriteEngine On

Then comes the rewrite condition, %{HTTPS} is a variable that is used if a domain has SSL. By !=on after it means that if the input domain does not have HTTPS then,

In the next line, regex is used to specify that after the beginning of forwarding slash anything written will be put after domain and https will be written before the domain name.

How to perform a Stress Test on your Web application using CyberLoader?

Follow CyberLoader on Facebook / Twitter.

Join our Facebook group.

Leave a Reply