If a search engine can reach the same page using different URLs, it can fail to give the page the ranking that it deserves.
Per Wikipedia,
“URL normalization (or URL canonicalization) is the process by which URLs are modified and standardized in a consistent manner.”
You may be asking “what does that mean” or “what does that have to do with getting more traffic on my website and more money in my pocket?”
Why? Let’s pretend that John F. Kennedy was a write-in candidate when he ran for president against Nixon. If half of the people voted for “John Kennedy” and the other half voted for “John .F Kennedy” he could have come in second (and third) if no one consolidated his votes.
A similar issue can happen with your web pages.
The following URLs will get you to the same destination:
- http://www.lovetherates.com
- http://www.lovetherates.com/index.htm
- http://lovetherates.com/index.htm
They could be separate pages with separate content, but they are not. If the back links that the page gets aren’t all credited to the same canonical version, the page faces the same problem that JFK had in our example.
How do you fix this? The steps are simple, but can be time consuming if you have a lot of pages on your site and don’t have some kind if CMS.
- Pick one canonical version
- Modify the following code with the appropriate URL for each page
<link rel="canonical" href="http://lovetherates.com/index.htm"/>
- Place in the code in the <head></head> section of each page
If you have a small site, this will be easy to do manually. However, if you have a larger site, you may want to use code to do the job for you. This works best if you have a template, but has its advantages even if you don’t. Once the code is installed, you can copy a page, change the body text, and have the correct canonical tag show up automatically for its new URL.
The following solution assumes that you have PHP enabled on your pages.
Place the following code either in the portion of your template that stores the global functions called on every page (or place it in the <head></head> section of each page).
function generate_canonical_tag_text()
{
$this_file = $_SERVER['PHP_SELF'];
$canonical_prefix = 'http://mysite.com';
$canonical_tag = <<<EOT
<link rel="canonical" href="$canonical_prefix$this_file"/>
EOT;
return($canonical_tag_text);
}
When modifying the code be sure to:
- use single quotes around http://mysite.com. The code will not work if you use regular double quotes.
- There should be no spaces on the same line before or after the following lines of code:
- $canonical_tag = <<<EOT
- EOT;
Place the following code on each page in the head section of each page.
<?php $canonical_tag_text = generate_canonical_tag_text(); print $canonical_tag_text; ?>
Using the canonical tag correctly can increase your ranking and get you more traffic.
$canonical_tag = <<<EOT






ShareThis