Forward HTTPS non-WWW to HTTPS WWW


I am having issues on my domain where all other url:,, both HTTP points to my, but when I access the, it does not redirect to the

I am using the Wordpress OpenLiteSpeed in DigitalOcean and have used most of the solutions in wordpress and OpenLite Speed Forum. I also tried using the plugin-Redirect and still not successful.

I managed to add this code in my .htaccess in /var/www/html as per suggested.

Any help is much appreciated.


Eric. Thanks for the quick response. Yes I have. Every time I update my htaccess, i do a restart.

Also, if it helps, I have also tried these separately:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
RewriteCond %{HTTPS} !^on$
RewriteRule (.*)$1 [R,L]
Given that I swap my domain to those placeholders.
This is what you need to do for your HTTPS redirect. If you're using Wordpress, make sure that you change the default URL to your site and dashboard to include HTTPS://WWW. YOURWEBSITE. If you don't do this you won't be able to access your Wordpress dashboard. Had the same problem and probably Litespeed need to include it by default when it comes to redirecting from non-HTTP WWW to HTTPS WWW

Then rewrite your .HTACCESS file with the following condition

RewriteCond %{HTTP:X-Forwarded-Proto} !^https$ [NC]
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule .*{REQUEST_URI} [R=301,L,NE]