Posted by Miki on January 6th, 2009 in SEO, Web Design

If you’ve noticed in your search engine listings that your homepage shows up twice, once for yourdomain.com and again for www.yourdomain.com, then you have what is called a canonical issue.

Basically, you need to pick which domain URL you want to have indexed, either the “www” version or the one without. Because if you don’t the search engines like Google will index both versions and you will be left with duplicate content, which is something you really don’t want to have if your wish is to climb in the rankings.

The choice is up to you as to if you want the “www” to show up or not. I prefer “www” but some don’t. Google uses it (try typing just “google.com” and you will see it resolve to “www.google .com”. Whereas “www.twitter.com” is the reverse. There’s no benefit per se either way that I know of, but you really have to choose one and then base all future links off it. Otherwise you’re headed for trouble. So the earlier you decide the better.

And the implementation for this is pretty simple. Just add the following code into your .htaccess file and in this case, your domain will always resolve to www.yourdomain.com.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

Now if you wanted the reverse, to go from www to without, the code would become:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]

Simple yet effective and it keeps the search engines a little happier when crawling your site.

There are other ways to code it (this will work on Apache), and you can also set a preference in Google Webmaster Tools.

Also, make sure that all your links within your domain and those backlinks use your preferred URL structure.


Post Your Thoughts

Name (required)

Mail (will not be published) (required)

Website

Copyright © 2004-2010 First Serve Media, LLC. All rights reserved.