Avoid Canonical Domain Issues
OK, so first things first what is a Canonical Domain and why is it bad for my site?
A Canonical Domain issue is where you effectively have two sites on the same site. This is normally where you have a non www. version and a www. version of your site available.
An exmaple of this would be http://www.domain.com and http://domain.com. This is a Canonical Domain.
OK, so Why is it bad?
A Canonical Domain issue is bad for your site because it potentially divides link weight between the two Canonical Domains when it should be consolidating the link weight into one single domain.
The biggest problem a web master has it not being able to control how people link to a site. It will inevitably happen where some links to the non www. version of your domain. Now you have the issue where your Canonical Domain is losing link weight and not giving you all the bennefit that it should be.
How do I Fix a Canonical Domain?
Good question! There are two things you need to do.
- Redirect the non www. version
- Set your preference in Google
Redirect the non www. version.
Installing the Non-WWW 301 Redirect on a Apache Server
If you have access to the root directory of the web server config (apachhe/conf) then you can modify httpd.conf and load the following module.
LoadModule rewrite_module modules/mod_rewrite.so
Next you need to put the following code into your .htaccess file.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
Example Server Header Response Code
You should see a server response code similar to the one below.
#1 Server Response: http://domain.com
HTTP Status Code: HTTP/1.1 301 Moved Permanently
Date: Thur, 08 Aug 2008 12:34:56 GMT
Server: Apache/1.3.27 (Unix) PHP/4.4.1 mod_ssl/2.8.14 OpenSSL/0.9.6b
Location: http://www.domain.com/
Connection: close
Content-Type: text/html; charset=iso-8859-1
Redirect Target: http://www.domain.com/
#2 Server Response: http://www.domain.com/
HTTP Status Code: HTTP/1.1 200 OK
Date: Thur, 08 Aug 2008 12:35:42 GMT
Server: Apache/1.3.27 (Unix) PHP/4.4.1 mod_ssl/2.8.14 OpenSSL/0.9.6b
Connection: close
Content-Type: text/html
Here is a useful link on how to do various types of redirection for canonical domains.
Set your preference in Google
Its a good iddea to make use of the features Google gives you in Webmaster Tools. Its also useful to read what Matt Cutts has to say about Google on Canonical Domains.
Go to Google Webmaster Tools and select the Tools option. Click on the option that says "Set preferred domain" and voila you're done!
The SEO Files Recomends
Avoid Canonical Domain issues and implement a 301 redirect to avoid domain canonicalization and set your preferred domain in Google Webmaster Tools.