How To Fix Canonical Domain Name Issues » The SEO Hobbyist

What is the Canonical Domain Issue?

This occurs when there isn’t a Permanent Redirect (301) found at the root level of your domain. If not configured properly, search engines will treat your domain “http://example.com” and “http://www.example.com” as two different sites. This can seriously hurt your rankings! We will use that same domain name in the code examples in this tutorial.

Why is it so Critical?

This issue gets so much attention because it’s such a simple mistake that can hurt your rankings an incredible amount. It also gets written about often because the fix is relatively simple (with the proper instruction).  Follow the instructions below to make sure you get the “Full Credit” from every search engine.

How Can I Check My Website for This Canonical Domains Problem?

The easiest way to test if your site has this issue is to run it through one the following analyzers.

They both will tell you very clearly if there are any canonical domain erros, as well as provide you other information about your domain that is often over looked.

Here’s How to Fix It:

There are many ways to fix the canonical domain issue.  The first example is by using an Apache .htaccess file with the following contents. If your preferred name is http://www.example.com, then add the following to a blank text file named .htaccess, and upload it to the domain root:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

Conversely, If your preferred domain is http://example.com then your last two lines would be:

rewritecond %{http_host} ^www.example.com [nc]
rewriterule ^(.*)$ http://example.com/$1 [r=301,nc]

If you website is built in PHP, you can fix it with the following code snippet:

<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>

And Finally, a 301 Canonical redirect using ASP:

<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("SCRIPT_NAME")
End if
%>

How Can I Verify The Fix?

After making the above changes, re-run your website through the analysers that I linked previously. The fix should take effect immediately.

I hope found this article informative. If you have any questions or comments, feel free to enter them below.

<p style=”padding-left: 30px;”>r

31 Responses to “How To Fix Canonical Domain Name Issues”

  1. Ian says:

    Very helpful, thanks!

  2. [...] This is the biggest killer of SEO rankings that I come across. It has a scary name but its really a simple idea. If you do not setup your domain name correctly, example.com will be treated as a completely separate site from http://www.example.com. Check out this post on How To Fix the Canonical Domain Issue. [...]

  3. Intimately, the post is actually the sweetest on this valuable topic. I agree with your conclusions and will thirstily look forward to your forthcoming updates. Just saying thanks will not just be adequate, for the great lucidity in your writing. I will at once grab your rss feed to stay abreast of any updates. Authentic work and much success in your business enterprize!

  4. I use both Adsense and Adbrite and i can say that adbrite is also a good source of income but not as good as adsense.;`-

  5. i always buy domain names at Godaddy or Moniker because they are the most reliable registrars;-.

  6. You have truly a interest individual posting design and present excellent details. The articles are great to read and you don´t use great deal ads like all of the other bloggers.

  7. Amelia Gray says:

    Adbrite is the ppc program that is second to adsense, i like adbrite’;”

  8. Virtual Girl says:

    Useful information, thanks!

  9. Thank you so much for posting this. I had originally tried to fix my canolitical errors in my .htaccess but for some reason it didn’t seem to make a difference. I’ve now plugged in the PHP snipet you posted above and it seems to be working.

    Thanks again :)

  10. i only use free seo tools on the internet coz there are lots of good ones out there.-”

  11. Keira James says:

    domain names should be as short as possible and easy to remember, i alway use Godaddy when signing up new domain names’;;

  12. angela says:

    I’ve been having problems with my client’s 301 redirect. He is using a plesk control panel which, as I’ve found out, is not the most user friendly control panel as there’s no way to do a redirect from there. I tried using ht .htaccess but to no avail. Any suggestion?

  13. Egg Donor says:

    i do not use adbrite because their pay rate is horrendously low compared to say infolinks :;~

  14. before you buy some very expensive SEO Tools, always look for a review first before you invest on them ‘.`

  15. We have over 30,000 pages on our site, and a canonical issue could be devastating without using 301 redirects. I like the way you pinpoint the exact coding necessary to fix them.

  16. soroush says:

    hi
    my web site some times down .
    im host reseller and this can effected all of my sites (all is down some times)
    in host tracker says(301 moved permanetly)
    please say me why?
    this message says what??
    and can i fix this problem..?

    thanks

  17. Dinesh says:

    I’ve been having problems with my client’s 301 redirect. He is using a plesk control panel which, as I’ve found out, is not the most user friendly control panel as there’s no way to do a redirect from there. I tried using ht .htaccess but to no avail. Any suggestion

  18. Tulle says:

    Beneficial details as well as outstanding layout you have right here! I would really like to appreciate discussing your ideas as well as period to the items you publish

  19. daniel says:

    even i placed .htaccess to root not redirecting

  20. Terrific paintings! That is the kind of info that are supposed to be shared around the web. Disgrace on the seek engines for not positioning this post higher! Come on over and talk over with my site . Thanks =)

  21. Remarkable things here. I am very glad to look your article. Thanks a lot and I’m taking a look ahead to touch you. Will you please drop me a mail?

  22. social media says:

    This is really interesting, You are an overly professional blogger. I’ve joined your feed and look ahead to seeking more of your great post. Additionally, I have shared your web site in my social networks

  23. to says:

    I am no longer sure where you’re getting your info, but great topic. I must spend a while learning much more or working out more. Thank you for great info I used to be searching for this information for my mission.

  24. WebPage says:

    I beloved as much as you will obtain performed proper here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get bought an nervousness over that you want be handing over the following. sick surely come more in the past again as exactly the similar just about very regularly inside case you defend this hike.

  25. Deborah Herald says:

    I found your blog site on google and test just a few of your early posts. Continue to maintain up the superb operate. I just extra up your RSS feed to my MSN Information Reader. In search of forward to reading extra from you in a while!

  26. German Coger says:

    I get pleasure from, lead to I discovered exactly what I used to be having a look for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye

  27. Alline Montminy says:

    Muy buen sitio. Muchas gracias por publicar articulos como estos en tu página!

  28. 1-clickmarketingmachine…

    adwords agency…

  29. I enjoyed looking at your blog and I needed to tell you that I totally agree with you. It is hard to find people that think likewise these days. Keep it up

  30. jemsseo says:

    Really a good blog that I found in google search.Keep it up.

Leave a Reply