SSL and www redirect.

#1
(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} www.ryder.link
RewriteRule (.*) https://ryder.link/$1 [R=301,L]
 

Attachments

Last edited:

serpent_driver

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

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

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

Code:
 RewriteCond %{HTTP_HOST} ^www\.
  RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
replace domain.com with you own domain name.
 
Last edited:
#9
@Valderes
Please tell us what you entered in the address bar and what you expect to happen.
When I put https://mysite.com.br I works fine. But When I put http://mysite.com.com.br 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.
 
Top