Redirecting Non-WWW to WWW

This is pretty basic stuff, but it is surprising how many webmasters forget this (even owners of bigger sites).

Search engines interpret the non-www version of your site’s URL (http://website.com) as a different page to the www version (http://www.website.com). This means that links to your site can be split between the two versions and can also effect the accuracy of web statistics.

This re-write condition for an Apache .htaccess file creates a permanent redirect from the non-www version to the www version:

RewriteCond %{HTTP_HOST} ^website\.co\.uk
RewriteRule (.*) http://www.website.co.uk/$1 [R=301,L]</pre>

If there are no other rewrite rules in the .htaccess file, the rewrite engine will need to be turned on using this line before the above commands:

RewriteEngine On

XML Feed for Free DIY SEO
Blog Home
Directory
About
Archive

Blog Categories

Free DIY SEO

Free SEO help, tips and DIY SEO advice for individuals and small businesses - Get higher rankings with DIY search engine optimisation