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:
Top