Wednesday 7 July 2010

Registrars 301 Redirect

You own two website domains and they’re both registered with the same registrar, for example:

mywebsite.co.uk
mywebsite.com

But you only want one of the domains to render, for example:

mywebsite.com

Simple you think, I'll use the web forwarding that my registrar provides; you carry this out, and hey presto it works - you type in 'mywebsite.co.uk' press return and you're redirected instantaneously to 'mywebsite.com'.

But it's not as simple as all that, because you see, most registrars don't use a search engine friendly 301 permanent redirect, no they use the not so friendly 302 temporary redirect; you can easily check yours by carrying out a 'server header check' at:

SEO Consultants

What’s you're options to implement a search engine friendly 301 redirect?

Go to the 'root folder' of your website, open up the .htaccess file and add a little 301 rewrite, for example:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?mywebsite\.co.uk [NC]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ http://www.mywebsite.com/$1?%1 [R=301]

You can read a little more about redirects here: redirects using search engine friendly 301.

But, before carrying out any changes to your root folder, make precautions and save the original file first and remember this is for 'php' sites – things are different with 'asp' and naturally I can't accept any liability ;-)

A better way of course, would be for the domain registrars to change their web forwarding from a 302 temporary to a Google friendly 301 permanent.