How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

July 14, 2020

redirect to https

Filed under: Linux — Tags: , , , , — admin @ 12:33 pm

I have more versions of redirect

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.matrafox.info/$1 [R,L]

Other version is

#non-www. http to www. https
RewriteCond %{ENV:HTTPS} !on
RewriteCond %{HTTP_HOST} ^(www.)?matrafox.info$
RewriteRule (.*) https://www.matrafox.info/$1 [R=301,L]

#non-www. https to www. https
RewriteCond %{ENV:HTTPS} on
RewriteCond %{HTTP_HOST} ^matrafox.info$
RewriteRule (.*) https://www.matrafox.info/$1 [R=301,L]

Other version is

RewriteEngine on

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^ https://www.example.com%{REQUEST_URI} [NC,L,R=301,NE]

Another one :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress