Add the below code to your htaccess file, replacing the domain name with yours.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.google\.co.uk$
RewriteRule (.*) http://www.google.co.uk/$1 [R=301,L]
Subscribe to new tech posts.
We will never send you spam email or forward your details to third parties.
This will close in 0 seconds
Good stuff this, we’ve just implemented this on our site to avoid having duplicate homepages in the index! Also to anyone reading, don’t forget you can specify in google webmaster tools if you want google to use the http:// or http://www. version of your site too.