Return to Snippet

Revision: 4688
at January 16, 2008 03:02 by torkil

Initial Code
# force www in url
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$$1 [R=301,L]
# END force www in url

Initial URL

Initial Description
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.

Initial Title
Force WWW in url

Initial Tags
url, htaccess, apache

Initial Language