/ Published in: Apache
Using mod_rewrite in Apache to rewrite urls and force removal of www in urls. Good for letting search engine spiders in the right door...
Insert the code in your .htaccess-file in your website's root folder.
Insert the code in your .htaccess-file in your website's root folder.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# force removal of www IN URL RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] # END force removal of www IN URL# force www IN URL
URL: http://www.torkiljohnsen.com/2008/01/16/some-easy-use-of-mod_rewrite/