HTTP to HTTPS WWW ? How do I achieve it?

Hello guys,

I want to redirect mysite.com to https://www.mysite.com. How do I achieve it? So far, I do have the SSL in place for both https://mysite.com and https://www.mysite.com. Even though I can easily set it to redirect from http://mysite.com to https://mysite.com, I don’t want to. I want it to redirect to https://www.mysite.com instead. How do I achieve it?

When I rewrite the rules it only works for https://mysite.com but breaks my website when I set it to redirect to https://www.mysite.com despite having the site accessible if you directly type https://www.mysite.com on the browser.

HTTP to HTTPS redirect

RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,L]

Canonical www redirect

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R,L]

Place on .htaccess file near the top. Make sure to restart your webserver.

# HTTP to HTTPS redirect RewriteCond %{SERVER_PORT} 80 RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,L]

Canonical www redirect

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R,L]

Place on .htaccess file near the top. Make sure to restart your webserver.

Thanks for you response. LiteSpeed support gave me the second option it works perfectly.

I managed to force my site to always default to WWW.domain.com. However, is there a way to reduce it to 1 or 2 redirects, so that the results will always be httpS.WWW.domain.com?

Currently I’m getting the following results from (http://httpstatus.io)