Created
October 8, 2018 12:10
-
-
Save webdados/92c1bfa16fed1a347c21c4b0ad923832 to your computer and use it in GitHub Desktop.
.htaccess rules to redirect http to http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Do NOT use this rules unless you are absolutely sure you do not have any mixed contents issues, or you may be masquerading them | |
# Redirect from http to https without www | |
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] | |
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L] | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
# Redirect from http to https with www | |
RewriteCond %{HTTP_HOST} ^domain.com$ [NC] | |
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L] | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment