SSL and www redirect.

(Screenshot below). Is there any way to have http://www go straight to https:// rather than what's currently shown below? Not sure what .htaccess rule it would be to have it all in one.

Current .htaccess file:

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"

RewriteCond %{HTTP_HOST}
RewriteRule (.*)$1 [R=301,L]


Last edited:


Well-Known Member
This will redirect all requests with http to https

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

And this will redirect all requests with www. to no non www.

 RewriteCond %{HTTP_HOST} ^www\.
  RewriteRule ^(.*)$$1 [R=301,L]
replace with you own domain name.
Last edited:
Please tell us what you entered in the address bar and what you expect to happen.
When I put I works fine. But When I put it shows the php code instead to redirect to https.

But I solved it :cool:. In my case the problem aparently was that openlitespeed was listening at 443 port and apache (surprise? o_O) was listening at 80 port. It make no sense for me why apache was installed, but... this is it.