Canonical URLs come in handy when a single page is accessible by multiple URLs or different pages have very similar content. Google or any other Search Engine considers these pages as duplicates and if you don’t explicitly tell them which version of the page is the main one, they might choose a URL themselves and crawl the remaining URLs less often.
So how can you tell the search engines to prefer one URL over the others that might have very similar or even the same content? You use an HTML element called canonical URL.
What are Canonical URLs?
Canonical URLs are HTML elements that help you tell search engines which is the most representative URL out of a set of duplicates on your site or across different sites.
For instance, if you have two URLs for the same page (
example.com/dresses/1234) you can assign one of them as the main URL. You can tell the search engines that the first version of the page (
example.com?dress=1234) is the canonical URL. So from then on, Google will crawl your Canonical URL normally but the canonicalised link (
example.com/dresses/1234 in this case) will be crawled less often.
To understand the importance of a Canonical URL, it’s important to first understand how Googlebot or any other search engine bot indexes and chooses the Canonical URL.
How Googlebot indexes and chooses a Canonical URL?
When Googlbot is indexing your site and finds multiple pages with the same content, then it tries to choose a page that it thinks is the most complete and relevant to the user. There are various factors that the Googlebot considers while choosing a Canonical URL, such as, whether the page is being served over HTTP or HTTPS, the page quality, whether the page is submitted in the sitemap and the
If you don’t explicitly tell Google or the other search engine bots, which URL should be chosen as the Canonical URL, they might choose a URL on their own and this can lead to unwanted behaviour.
As mentioned above, the canonical URL is crawled more often than the other URLs that are considered as duplicates since the search engine crawlers want to reduce the crawl load on your site. So, it’s important to always assign a Canonical URL in such cases.
But wait, Isn’t it bad to have duplicate content?
No, there might be some valid reasons for duplicate content to exist. As mentioned in our Content Syndication post – popular to the contrary belief, there is no such thing as duplicate content penalty.
When is it ok to have similar or duplicate pages?
Google gives a list of various scenarios where it might be ok to have duplicate or similar pages. Keep in mind, the pages don’t have to be exactly identical to be considered duplicates. Simple sorting and filtering of list pages do not make the pages unique.
Here are a few valid reasons why you might have different URLs pointing to the same page or have multiple pages with very similar content:
1. To support multiple devices:
Let’s look at a real-life example of this:
RealEstate.com.au is an extremely famous property site in Australia. You can visit the buy property section of the website in two ways:
2. To enable Dynamic URLs for things like Query Parameters:
URLs can sometimes contain Query Parameters. Query Parameters are used to define certain content or actions depending on the data being passed.
Let’s look at an example. JBhifi.com.au is an electronics store in Australia. Let’s look at the iPhone collection on their website:
The link below as of 25 Feb 2022 showcases 85 products on the page.
If I try to sort the products based on Price (Low to High), I get the same 85 products but sorted according to the price. Notice how a query parameter gets added to the end of the URL (sortBy=price_asc)
In the above example, I get the same page but through two different URLs.
3. If your blog system saves the Multiple URLs as you place one post in multiple categories:
For instance, you are writing a post on the latest iOS software for your tech blog. You can place this post under two categories: Apple and Latest Tech News.
Depending on your permalink structure, your blog can generate two different URLs that lead to the same post:
4. If your server is configured to serve the same content for www/non-www http/https variants:
http://www.yourtechblog.com/ https://www.yourtechblog.com/ https://yourtechblog.com/
5. If you republish your existing content on other websites (Content Syndication) to reach a broader audience:
You can learn more about Content Syndication and how to do it properly from our post.
Let’s look at an example from this blog itself. I wrote a post on my blog and then republished the entire thing on Medium.com.
How does a Canonical URL Look?
Before we move on to why you should use Canonical URLs, let’s see how it looks first. Canonical URLs cannot be seen by the visitors on your site, they are only visible to the search engine bots and they can be defined in the page source or HTTP Header.
1. HTTP Header
In the HTTP Header, your Canonical URLs will look something like this:
HTTP/... 200 OK ... Link: <https://example.com/blog>; rel="canonical"
This is the approach to take if you’re putting Canonical URLs for files, such as, PDFs.
2. Page Source / <Head> Section of the site
This should be located in the
<head> section of your page code. It looks something like this:
<link rel="canonical" href="https://example.com/blog">
If you want to see which approach works for you, Google has a great comparison in this blog post.
Why and When should you use Canonical URLs?
There are many reasons why you should use Canonical URLs. Let’s look at some of them:
1. To specify which URL visitors see on the search engine:
If we consider the same example from above, if you have two URLs that lead to the same page on your website you might want visitors to reach your red shoes product page via
https://www.example.com/shoes/red/redshoes.html and not
2. To consolidate the link signals for duplicate or similar pages:
Specifying the Canonical URL helps Google and other search engines to consolidate link signals for duplicate or similar pages to one single URL. For instance, any links from other sites to
https://www.example.com/products?category=shoes&color=red gets consolidated with links to
https://www.example.com/shoes/red/redshoes.html, which is your preferred URL.
3. To manage syndicated content:
If you syndicate your content to other domains, you will definitely want to add the canonical URL to ensure that your preferred URL appears in search results.
Depending on your requirements, the canonical URL can be the post on your website (if you want that post to get more attention from Google) or the syndicated post on the external domain.
4. To avoid wastage of crawl budget on duplicate pages:
As your website grows, you’ll want Google and other search engines to crawl and index new pages rather than wasting time crawling multiple duplicate pages.
5. Communicate the relationship between the desktop and mobile version of pages:
When you have mobile and desktop versions of your website, it’s important to communicate the relationship between these pages to Google. You do this using Canonical URL and rel=”alternate”.
Let’s look at the above example of Realestate.com.au. If we have a look at the page source of their desktop and mobile sites, we can see how they make use of rel=”canonical” and rel=”alternate”.
6. Canonical URL referencing itself:
Even if there is only one version of the page, just ensure that the canonical URL self-references. They are not absolutely necessary but they do help.
How should you add Canonical URLs?
There are various ways in which you can add Canonical URLs to your page. As mentioned above you can manually add it either in the page source or the HTTP Header of your page.
However, if you’re on one of the popular CMS like WordPress, Wix or Shopify, it’s extremely easy to define a canonical URL. Here’s how you can do it on either of these platforms:
How to Add Canonical URL in WordPress?
1. Download and Install the Yoast SEO Plugin
Plugins like Yoast SEO make it extremely easy to edit the canonical URL for any page.
2. Go to the Post/Page that you want to edit the Canonical URL for
From the left-hand navigation of the WordPress Dashboard, find the post or the page that you want to edit the Canonical URL for. Once you’ve found the required post/page, click on Edit.
3. Go the the Advanced Section of Yoast SEO and edit the Canonical URL
Enter the FULL CANONICAL URL, including the https/http and www or non-www.
How to Add Canonical URL in Shopify?
1. Install the Yoast SEO app in Shopfy
Yoast SEO has a nice and simple-to-use app for Shopify as well. If you do not want to download the app, then you can edit the Canonical URLs by editing the theme.liquid file. Here’s a guide to help you with that approach.
2. In the Optimize section of the Yoast SEO App, select the page, product, collection etc that you want to edit the Canonical URL of
3. Go to the Advanced section of the Yoast SEO Sidebar and enter the full Canonical URL with the http/https, www or non-www version:
How to Add Canonical URL in Wix?
1. Go to the Page’s SEO Settings
To do this, click on the Menus and Pages Icon from the sidebar. Then click on the three dots next to the page you want to edit the Canonical URL of and click on SEO Basics.
2. Edit the Canonical URL
Click on the Advanced SEO tab, go to Additional Tags and edit the canonical URL field.
General Guidelines for Canonical URLs
There are few best practices that you should follow while using Canonical URLs:
- Use Absolute URLs: This is extremely important. Use the full domain, the HTTP or HTTPS and www or non-www version. There should be no doubt about which link has to be indexed. For instance, use
- Don’t use robots.txt for canonicalization purposes.
- Make sure that the canonical URL points to an indexable URL.
- There should only be one canonical URL per page. (For instance, don’t specify one canonical URL using the HTTP Header method and another one using the rel=”canonical” method).