Created
December 12, 2017 12:18
-
-
Save ashucg/5293b4524222f80f8270ee77eeef2933 to your computer and use it in GitHub Desktop.
htaccess redirect non-www to www and 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteCond %{HTTPS} off [NC] | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment