Created
March 17, 2017 05:30
-
-
Save eliandoran/e7ce39f7750463475389bafbbefaef67 to your computer and use it in GitHub Desktop.
Redirect traffic from HTTP to HTTPS
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
# BEGIN Redirection to HTTPS | |
<IfModule mod_rewrite.c> | |
RewriteCond %{HTTPS} off | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteCond .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IfModule> | |
# END Redirection to HTTPS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit:
Michael Berkowski @ Stack Overflow
http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www