Created
November 2, 2014 07:45
-
-
Save gnilchee/4ebcbf139cd4d5428206 to your computer and use it in GitHub Desktop.
redirect ANY naked domains to www.domain.tld
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
## This is to allow all incoming naked domains to be rewritten as www.domain.tld | |
RewriteEngine on | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
RewriteCond %{HTTPS} on | |
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment