Created
May 5, 2014 06:56
-
-
Save antoniputra/e53e4db5fa1ad5d0beab to your computer and use it in GitHub Desktop.
Force domain with or without www on .htaccess
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
# FORCE USING WWW | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^your-site.com [NC] | |
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301] | |
# FORCE REMOVE WWW | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC] | |
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment