×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Apache
Posted by: Massimo Zappino
Added: Feb 15, 2011 2:53 PM
Views: 168
Tags: .htaccess www
  1. # FORCE WWW
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^example.com [NC]
  4. RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]
  5.  
  6. # REMOVE WWW
  7. RewriteEngine On
  8. RewriteCond %{HTTP_HOST} !^example.com$ [NC]
  9. RewriteRule ^(.*)$ http://example.com/$1 [L,R=301