Canonical URLs / URL Canonicalization

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Canonical URLs / URL Canonicalization

Post by Albert Wiersch »

This is an interesting issue I didn't think of.

Here is a good link on the subject:
Q: What is a canonical url? Do you have to use such a weird word, anyway?
A: Sorry that it’s a strange word; that’s what we call it around Google. Canonicalization is the process of picking the best url when there are several choices, and it usually refers to home pages. For example, most people would consider these the same urls:

* http://www.example.com
* example.com/
* http://www.example.com/index.html
* example.com/home.asp

But technically all of these urls are different. A web server could return completely different content for all the urls above. When Google “canonicalizes” a url, we try to pick the url that seems like the best representative from that set.
Source:
Matt Cutts: Gadgets, Google, and SEO

Here's how my electronic dictionary defines canonical (the relevent definition out of several): Reduced to the simplest and most significant form possible without loss of generality

So what am I doing? I am now using a 301 (permanent) redirect. If you try to access the CSE HTML Validator website with htmlvalidator.com instead of http://www.htmlvalidator.com, it should now redirect to the http://www.htmlvalidator.com domain. Try it out. :D

Information about how to do this is here:
http://www.google.com/#hl=en&source=hp& ... 88018abe0f

I now use this in my Apache config file:

Code: Select all

 RewriteEngine on
 RewriteCond %{HTTP_HOST} ^htmlvalidator\.com
 RewriteRule ^(.*)$ http://www.htmlvalidator.com$1 [R=permanent,L]
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
omnireso
Rank 0 - Newcomer
Posts: 4
Joined: Mon Mar 14, 2011 4:08 am

Re: Canonical URLs / URL Canonicalization

Post by omnireso »

Thanks, that's a very (even if mostly underrated) important info.

Depending on your Apache Conf., you will somteimes need to begin the .htacess by :

Code: Select all

Options +FollowSymlinks