/ Published in: Other
Add and remove www to urls through .htaccess with mod_rewrite
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# add www to any url RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] # remove www from any url Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
URL: http://www.barattalo.it/2010/05/02/10-htaccess-usefull-tips/