301 Redirect for Non-WWW site

An important (and easy) aspect of optimising your site for the search engines is ensuring the non-www version of a URL (http://example.com) redirects to the www version (http://www.example.com).

This is because search engines see the www and non-www versions as different pages leading to duplication issues, splitting of the power of incoming links and inaccurate web stats.

To redirect the non-www version add the following re-write condition to the Apache .htaccess file for a site (this is found in the root folder of a site):

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

Close
E-mail It
Socialized through Gregarious 42