Adding www to every url
Tags: .htaccess, url
Date: 4th May, 2010
Damn it, I hate ‘www’, but someone was insisting on only using it. Here’s the .htaccess code:
RewriteCond %{REQUEST_URI} !^/(robots\.txt|favicon\.ico|sitemap\.xml)$
RewriteCond %{HTTP_HOST} !^www\.mrportman\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.mrportman.co\.uk/$1 [R=301,L]