Last active
August 29, 2015 14:07
-
-
Save jeremyyeo/9a5aee8458d2d073d516 to your computer and use it in GitHub Desktop.
Non-www to www
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
# Only use either one: non-www to www or www to non-www. | |
# Redirecting non-www to www | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
# Redirecting www to non-www | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] | |
RewriteEngine on | |
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment