Last active
May 11, 2017 00:31
-
-
Save cobbman/3f4ce6014b7eba11546b9bd20727be90 to your computer and use it in GitHub Desktop.
universal htaccess force www
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
### BEGIN FORCE WWW OR NON-WWW | |
<ifModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteBase / | |
#Force non-www: | |
#RewriteCond %{HTTP_HOST} www.(.*)$ [NC] | |
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L] | |
#Force www: | |
#RewriteCond %{HTTP_HOST} !^www. [NC] | |
#RewriteCond %{HTTP_HOST} ^(.+)$ [NC] | |
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] | |
</IfModule> | |
### END FORCE WWW OR NON-WWW |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment