What the heck is a canonical URL? I didn’t know what a canonical URL was at first either, so don’t worry if you don’t know.
Canonical essentially means “standard” or “authoritative”, so a canonical URL for search engine marketing purposes is the URL you want people to see. Depending on how your web site was programmed or how your tracking URLs are setup for marketing campaign, there may be more than one URL for a particular web page.
The problem most search engine marketers run into deals with domains. Sometimes if a domain is not setup properly, the domain URL (domain.com) and the www domain URL (www.domain.com) are considered individual web pages. Since both pages maybe indexed by Google – you could get hit for duplicate content and at the very least you would be splitting your link popularity.
The easiest way to protect your site is to redirect all forms of your domain to one “standard” URL – a canonical URL.
For example to force the use of www.socialpatterns.com instead of socialpatterns.com, I have these lines in my .htaccess file. (This is Apache specific, if you use IIS the lines should be the same using ISAPI filter)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^socialpatterns\.com$ [NC]
RewriteRule ^(.*)$ http://www.socialpatterns.com/$1 [R=301,L]
The first line “RewriteEngine On” tells Apache to enable Mod_rewrite – the engine responsible for manipulating URLs.
The second line “RewriteCond %{HTTP_HOST} ^socialpatterns\.com$ [NC]” looks for when people access socialpatterns.com. The “[NC]” flag makes the test case-insensitive, so it catches URLs like SoCiAlPatTerns.com.
The third line “RewriteRule ^(.*)$ http://www.socialpatterns.com/$1 [R=301,L]” redirects socialpatterns.com to www.socialpatterns.com with a 301 redirect.
So if someone else buys your domain without the www, then they can really jack your link popularity and probably get you banned eventually. Right?
If so everyone would need to run out and buy that version of their domain and use 301 redirect on it immediately!
Hunter:
The domain with the www and without are the same domain. Remember that when you purchase a domain you have full access/control of the subdomains. No one can buy a seperate subdomain of your own domain.
Hey, thanks for the tip! I just implemented it and it worked perfectly
I love this site. Good good stuff.
Awesome tip — thanks!
Sorry for maybe asking a dumb question, but what would be the same varient for the .htaccess for my .asp hosted sites? Thanks
What do you mean by “should be the same using ISAPI filter” I have some Windows hosting that I would like to use this .htaccess file idea with
Please advise (2nd request)
Why not just set your DNS A records so that http://www.website.com and website.com go to the same website.
Seems a little easier and less code to deal with.
Does anyone monitor this comments/posts????
Travis,
The problem lies in how Google views each of these urls. Even though DNS typically points the two urls to the same website, Google will consider the two urls as seperate sites without a 301.
Tim,
ISAPI Filter is a mod_rewrite type program you can add onto IIS. If you are using apache, then the rules would be the same – just change the domain to your website.
Unhappy,
Yes.
Pingback: Search Engine Journal » MSN’s Google PageRank of 2 and Canonical URL Problems
Michael
Is there anyway to just upload an .htaccess file onto your windows hosted domain that will give you the same results as listed above?
Thanks
Would the above example wipe out any subdomains that you might be using?
Pingback: » A Summary of 301 Redirect Knowledge - Stuntdubl - SEO Consultant
Hello, I put the code in my .htaccess file (editing the url, obviously) and when I try to enter to my site it shows an “500 error”.
What is happening?
Thank you SOOOOOOOOOO much for the tip. This resolved my problem IMMEDIATELY and will prevent improper search engine crawling. Thank you!!!!
Finally a solution that works for me.
Thanks a lot,
Will
Nothing I try seems to accomplish the renaming. The old name I am having trouble with is permanently forwarded by the old ISP to the new address but for some reason it locks the old name into place.
The old site la-ldr.site.org needs to become community.site.org
How does google etc treat these subdomains of the main site.org?
I thinks it’s about time Google resolved this issue on their side of things, not ask all millions of Website owners to change what has been ‘the norm’ since the begining of the internet.
What about http://www.goldbar.net, http://www.goldbar.net/index.html , what should I do with it?
Goldbar,
Point everything to one url or the other. I recommend sticking with the http://www.goldbar.net url.
I tried to redirect urls of my website http://www.goldbar.net using 301 and everone of them has been giving me an
error saying that I get the following error message “Redirection limit for
this URL exceeded. Unable to load the requested page. This may be caused
by cookies that are blocked”.
Any ideas?
Pingback: SEO delusions » Another lesson in SEO: Site Availability
Pingback: Matt Cutts: Gadgets, Google, and SEO » Canonicalization update
My question is (not knowing much about apache) is it a simple matter of swapping the two URL parts if domain.com is your preference to direct to?
Pingback: Canonicalization update - rankoz.com
great info, thanks!
But I need to extend this a bit and not sure how exactly to do it.
I have 2 domains, domain.com and domain.org, that point to the same site.
How do I redirect http://domain.org, http://www.domain.org and http://domain.com to http://www.domain.com
Pingback: Canonicalization update · djanggo.com
I have a domain and a sub-domain, both with the same content. The original domain “example.com” was a static site and we needed to add a shopping cart. I used a sub-domain “example.example.com” to build the shopping cart site and test it out. Once completed, I did a redirect on the “example.com” site to point to the “example.example.com” site.
I am now using the original site “example.com” for testing, of course I still have the redirect. Would this be considered duplicate?
Pingback: einfach persoenlich Weblog
Hi all…
Relative newbie here learning about all this after just create a web site for my new business venture. I just published my site and Google searches just began displaying some of the pages last night. As I was exploring Webmaster Tools yesterday I discovered in the Settings tab the option to choose a preferred URL or not.
Have to admit this is a bit overwhelming for a beginner but I was wondering if someone could elaborate a bit more on how to check (and what to look for) with regard to “internal links”. I assume you’re referring to the links on each web page that link to all the other pages on your site? So what is it that we’re supposed to look for?
Hi,
Thank you very much, I hope this will help me to rank better in Google.