Redirect all HTTP traffic to HTTPS on OpenLiteSpeed

When installing an SSL certificate on your website, you will need to ensure that all HTTP traffic is forced to upgrade to HTTPS. This is done by means of a redirect configuration on the OpenLiteSpeed web server.

These instructions assume that an SSL certificate is already installed and configured.

  • Login to your OpenLiteSpeed Web Admin Console.
  • Click on “Virtual Hosts”
  • Click on the virtual host you would like to redirect all traffic for.
  • Click on “Rewrite” from the sub top navigation bar.
  • Copy the following code snippet:
RewriteCond %{SERVER_PORT} ^80$

RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
  • Click on “Edit” in the top right of the “Rewrite Condition” box and change “Enable Rewrite” from No to Yes.
  • Click on the “Edit” icon in the top right of the “Rewrite Rules” and paste the code snippet into the Rewrite Rules form field:

Click Save, and do a graceful restart.


That’s it, you’re done.