SEO – Canonical URLs

Canonical URL refers to the primary or master URL from a set of duplicated pages on your site.

In simple words, if your website has 4 URLs which display the same content, which is the main page you want to rank on search engines. If you do not set a single canonical URL, the search engine will index all duplicate pages which may harm SEO ranking for those pages.

It is recommended to set your canonical URL by mentioning your master URL in all those similar pages. We will have more understanding of this in the next example.


How to Add Canonical Tag in HTML:

The most common example of a page with multiple URLs is the homepage. Mostly, the homepage can be accessed via multiple URLs as given below:

http://www.tutorialsclass.com
https://www.tutorialsclass.com
http://tutorialsclass.com
https://tutorialsclass.com
http://tutorialsclass.com/index.php [If PHP website]
http://tutorialsclass.com/index.html [If html website]

Search Engines can treat each of these URLs as a different page with the same content which is not good for SEO. Why?

Here, the first issue is that one URL can compete with other URLs for SEO ranking because, both targets the same content. The second issue is that it can be treated as duplicate content on those URLs, which can affect your SEO ranking. The solution is to set the most important URL as canonical.

Let us suppose we have “https://tutorialsclass.com/” URL (with https and without www) as the main URL. We want the same to be ranked for search engines, so we can set the following as a canonical URL in all above pages. You need to use <link> tag in your head tag on a web page.

<link rel="canonical" href="https://tutorialsclass.com/" />

How Canonical URL works in Search Engines?

As described in Google Help Docs, search engine bots regularly find your website pages for indexing. When there are multiple pages with similar content, it tries to choose the most useful URL and consider it canonical. The decision could be based on various factors, most importantly which page is most linked from other pages or which page has the most traffic.

You should not always rely on Search engines, so always set canonical URL by yourself and help search engines. The canonical page always crawled frequently while other duplicate pages crawled rarely. Therefore, mostly you will see your canonical URL in Search Engine Result Pages (SERP).


More Examples:

There are many websites that load the same content with different URLs. One such example is an e-commerce website where the same product is loaded with different URLs.

We will take an example of Samsung Smartphone (Samsung Galaxy M31) listed on the Amazon website. The main link of the product is:
Link 1: (Main Link) https://www.amazon.in/Samsung-Galaxy-Ocean-128GB-Storage/dp/B07HGGYWL6

When you search for “Samsung Galaxy M31” in amazon and click on the link, it adds extra information (keyword) in the URL for the same product. This information is used by Amazon to track how the user found this product for their analytics.
Link 2: https://www.amazon.in/Samsung-Galaxy-Ocean-128GB-Storage/dp/B07HGGYWL6/ref=sr_1_2?dchild=1&keywords=Samsung+Galaxy+M31+%28Ocean+Blue%2C+6GB+RAM%2C+128GB+Storage%29&qid=1595014774&s=electronics&sr=1-2

Sometimes we find same product page via some affiliated link in some YouTube unboxing video descriptions. Here, you can see extra parameter or query string related to affiliated tag information in URL:
Link 3: https://www.amazon.in/gp/product/B07HGGYWL6/ref=as_li_qf_asin_il_tl?ie=UTF8&tag=manishaaffili-21&creative=24630&linkCode=as2&creativeASIN=B07HGGYWL6&linkId=4f33f1fbceb5a19bdb3c9df57716ac8d

See how all these different URLs take us to the same product. Therefore, it is important to set a single canonical URL. Otherwise, these URLs can give duplicate content impressions for search engines.

You can see that Amazon has set the canonical URL for all these pages. If you see their source code (Right Click on page > View Source Code), you will find all of those pages use same canonical URL as given below:

<link rel="canonical" href="https://www.amazon.in/Samsung-Galaxy-Ocean-128GB-Storage/dp/B07HGGYWL6" />

Important Points

  1. Check CMS settings for duplicate content: Many CMS automatic generate URLs for pages. Sometimes, the same content is available on multiple URLs. For example, If you search using “SEO”, it may list similar topics that are listed in “SEO” category. Make sure that if multiple pages are displaying similar content, you should set Canonical URL for them.
  1. Avoid Mixed/Chain Canonical: When Canonicalize or redirect all similar content pages to a single page, you should avoid mixed signals. For example, if you have three similar pages A, B & C. Let us suppose C is the master URL that you want to index. Then, do not canonicalize chains such as Page A ==> B, and then B ==> C. Directly use A ==> C, and B ==> C.
  1. Do not canonical/redirect each other: Don’t canonicalize page A ==> page B and then page B ==> page A. Make sure you have only one canonical URL and that should not point to another one.
  1. Set Canonical for cross-domain duplicates: If your content is same on two different websites, you can set same canonical URL to both so that Search engine provide a ranking for the main website instead of competing with each other.
  1. Set 301 Redirect if required: If you do not want to show any page content and want to show another similar page, you can implement redirection. Often, redirection is used to redirect HTTP pages to HTTPS. It is also useful when you have a better or new page for similar content. If you want both pages to be accessible, then you should not redirect but only implement canonical to prevent duplicate content.

Useful Tools:

Yoast SEO – WordPress Plugin: If you are using WordPress site, you can set canonical URL using Yoast SEO plugin to any post/page without HTML code. Go to Dashboard > Posts or Pages > Yoast SEO meta box > Advanced > Enter the full canonical URL in the ‘Canonical URL’ field.

Note: Yoast SEO canonical setting will not if work your website setting is “discouraged for search engines.”

SEO Extension [Metrics, Backlinks, On-Page]: This is a Browser extension (Chrome) developed by Mangools. You can see any web page Meta along with its canonical information if set.

Canonical URL Checker by SiteChecker.pro: You can use SiteChecker to test if Canonical URL is set for any page.


Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.