/ Published in: Apache
Using mod_rewrite in Apache to rewrite urls and force users to use 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 www in url RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] # END force www in url
URL: http://www.torkiljohnsen.com/2008/01/16/some-easy-use-of-mod_rewrite/