Created
October 10, 2016 11:27
-
-
Save isaumya/b04fa381e8a79f8e3a559e6b69013e17 to your computer and use it in GitHub Desktop.
Code for doing 301 HTTPS redirection for any site using .htaccess
This file contains hidden or 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
<IfModule mod_headers.c> | |
RewriteEngine on | |
RewriteBase / | |
RewriteCond %{http_host} !^www.example.com$ [nc,OR] | |
RewriteCond %{SERVER_PORT} !^443$ | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment