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
Posted: December 13th, 2007 under Search Engine Optimisation.
Comments: Leave yours - 2 so far
Bookmark:
Comments
Comment from Maan Chua
Time: January 18, 2008, 11:18 am
That would be very helpful for those who doesn’t know how to redirect a non-www to www but now a days its automatically included the .htaccess or just have request to your web domain company to do it for you. In search engine optimization its another basic we must to do to get a successful web site campaign.
Comment from dan
Time: January 18, 2008, 5:37 pm
You are right. But I was reminded of this when I was asked to look at a site hosted with pretty big host in the UK. Maybe they had edited their .htaccess and removed it?

Write a comment