When you get deeper into technical SEO, you’ll come across canonical URLs (rel=”canonical”) and if you don’t know what a canonical URL is and what it does, it can get confusing.
The purpose of this post is to remove the confusion and help you understand in simple terms what is the meaning of a canonical URL and how to use Canonical URLs correctly.
This guide covers the following topics:
- Definition of a Canonical URL
- How do I find my canonical URL?
- Canonical Tags Use Cases
- Canonical URL Examples
- Canonical Tag Best Practices
- Canonical tags vs. 301 redirects
- Advantages of using Canonical Tags for SEO
- How to set canonical URLs in WordPress?
- How to set canonical URLs in any CMS?
- Resources to learn more about canonical URLs
What is a Canonical URL?
A canonical URL is added in the HEAD section of a page and tells search engines which is the preferred URL for the particular page. A canonical URL can point to itself (self-referencing) or to a different URL.
Canonical Tags are most commonly used to:
- Help webmasters solve duplicate content issues
- Help search engines index the most appropriate page (in case pages have similar/identical content)
- Help webmasters specify their preferred domain
- It’s a way to consolidate incoming links to a specific page
- It’s a way to protect your PageRank from websites that copy your content
- It’s a way to avoid duplicate content issues when syndicating content
- It’s a way to specify which page to index in cases where you have accelerated mobile pages (AMP) enabled on your site
How do I find my canonical URL?
A canonical URL is only visible to search engine crawlers and not users. It is added to the <HEAD></HEAD> section of a page and has the following format:
<link rel="canonical" href="CANONICAL-URL"/>
To find the canonical URL of page use one of the methods below:
View the HTML Source of a page
Open a webpage in Chrome and select VIEW > DEVELOPER > VIEW SOURCE from the top menu, to view the HTML source of a page.
Search for the word ‘Canonical’. If the canonical tag is defined, it should look like this:
<link rel="canonical" href="https://www.reliablesoft.net/what-is-a-canonical-url"/>
If you cannot find the word canonical in your HTML, then this means that there is no canonical URL defined for the particular page.
Using the URL Inspection Tool
The URL inspection tool is part of Google Search Console and among other things, it shows you what Google considers to be the canonical URL of a page.
- Login to Google Search Console
- Type a URL in the URL Inspection Tool and press Enter
- Open the COVERAGE section of the report
- Look for ‘Google-selected Canonical’
If the value is ‘inspected URL’ this means that the canonical URL is the same as the page URL. If Google selects a different canonical URL, it will show the value in that area.
When and How to use Canonical URLs?
Duplicate Content
A website is more likely to have duplicate content issues, even if you don’t intentionally duplicate your content across different URLs.
Typical cases of duplicate content include:
A URL is accessible with or without www in the URL – For example:
http://reliablesoft.net/post-title
and http://www.reliablesoft.net/post-title
A URL is accessible with both Http and Https protocols – For example:
https://reliablesoft.net/post-title and http://reliablesoft.net/post-title
Pages that have print friendly versions – For example:
https://www.reliablesoft.net/post-title/
and https://www.reliablesoft.net/post-title/?print=true
Pages with identical content but different URLs – For example:
https://www.reliablesoft.net/courses/SEO-Course
and https://www.reliablesoft.net/seo-course
Duplicate Content on eCommerce Websites
Product category pages that have the same content and using filters – For example:
https://www.reliablesoft.net/products/shoes/?color=white
and https://ww.reliablesoft.net/products/shoes
Both product pages show the same shoes but in different colors. For Google, this is considered as a duplicate content.
In all the above cases, setting the canonical URL allows you to tell search engines which URL to include in their search results.
Self-Referencing Canonical Tag
Do I need to use a canonical URL on pages that have original content? – Yes, and the main reason is that it’s a way to protect your content. In cases where someone replicates your website, the canonical URL will tell search engines what the original source is.
Content Syndication
Content Syndication and canonical URLs – When you re-publish or syndicate your content on other platforms i.e. medium or LinkedIn Posts, you can use the canonical URL to tell Google that this is an exact copy of an existing URL and in this way, you ensure that Google knows the original source of an article.
Specifying your preferred domain to Google
A website that is accessible through different URLs (with www or without www, with Http and Https) is considered by Google as different websites.
Google can get confused as to which version to index and to help them in this task, you need to specify your preferred domain.
Previously this was possible through the Google Search Console but now the only way to tell Google what your preferred domain is through canonical tags.
You can do this by:
- Specifying a canonical URL for your homepage
- Specifying a canonical URL of all your site pages
- Using the same URL format for all your canonical tags
For example, if you specify the canonical URL on the homepage to be:
<link rel="canonical" href="https://www.reliablesoft.net/"/>
then all other canonicals should have the https and www in the URLs.
Consistency in the canonical tags helps Google identify which is your preferred domain.
Canonical URL Examples
To help you understand how to set your canonical tags, here is an example of how they work.
Let’s assume that the content of this page https://www.reliablesoft.net/courses/SEO-Course
is the same as this https://www.reliablesoft.net/seo-course
and you want Google to index the second one.
In this case, you need to set your canonical URLs as follows:
On this page https://www.reliablesoft.net/courses/SEO-Course
the canonical URL should point to the other page, i.e.
<link rel="canonical" href="https://www.reliablesoft.net/seo-course"/>
On this page, https://www.reliablesoft.net/seo-course
the canonical URL will be self-referencing i.e. it will point to the page itself.
<link rel="canonical" href="https://www.reliablesoft.net/seo-course"/>
This way you tell Google which page to add in their index and show in the search results.
Duplicate Content in Product Category Pages
Here is another example of how canonical tags can help you solve the problem of duplicate content for your eCommerce category pages.
Let’s assume that you have a category page that displays shoes in different colors.
Users can narrow the results by selecting the color from a dropdown filter.
This is the main page https://www.reliablesoft.net/products/shoes/
and this is one of the pages that are generated when users select the color from a filter https://www.reliablesoft.net/products/shoes/?color=white
Both pages have exactly the same content, the only difference is the product images that show shoes in white color only. This is a typical scenario of duplicate content pages on eCommerce websites.
In this case, you need to set your canonical URLs as follows:
On this page https://www.reliablesoft.net/products/shoes/?color=white
the canonical URL should point to the main category page, i.e
<link rel="canonical" href="https://www.reliablesoft.net/products/shoes/"/>
On this page, https://www.reliablesoft.net/products/shoes/
the canonical URL will be self-referencing i.e. it will point to the page itself.
<link rel="canonical" href=" https://www.reliablesoft.net/products/shoes/"/>
Canonical Tags Best Practices
- Each page must have a canonical URL that points to the page itself or some other URL.
- There must be only one canonical URL per page.
- The canonical tag is specified in the HEAD of the page.
- The URL specified in the rel=”canonical” tag should be valid
- The URL specified in the rel=”canonical” tag should not have the “noindex” attribute.
- Avoid pointing the canonical URL to a page that has a canonical tag that is not self-referencing i.e. points to another page. This will create a loop and confuse crawlers.
- Use canonicalization when pages have duplicate or similar content. Do not use the canonical tag on pages that have different content. Consider using a redirection.
- Canonical URLs should point to pages in the same language. For multi-language websites, you can use “href lang” attribute to specify the different versions.
- The homepage needs to have a canonical URL defined that specifies the preferred domain.
- All canonical URLS should follow the same format as the homepage.
- If you have Accelerated Mobile Pages (AMP) enabled on your site, check that the canonical URL of every page points to the non-AMP version.
What is the main difference between canonical tags and 301 Redirections?
When you set 301 redirection users don’t see the source page but they only see the target. In the case of canonical tags, users can still see both pages but search engines are told not to consider one of the two.
In both cases, backlinks are consolidated to the target page.
As a general rule, use a canonical URL when you want to keep the page on your site, for navigation or user purposes and use a 301 when you don’t want users to see the particular page.
Advantages of using Canonical Tags for SEO
When it comes to SEO, accurately setting your canonical URLs has the following advantages:
- Lets you define your preferred domain. Previously this was possible through the Google Search Console but now the only way to tell search engines what you prefer is through canonical tags.
- Lets you define which version of a page you want to be included in the search results.
- Improves the PageRank of specific pages by consolidating links.
- It protects your PageRank when other websites steal your content.
- It’s a great way to optimize your crawl budget but avoiding crawling pages with duplicate content.
How to set canonical URLs in WordPress?
The easiest way to specify the canonical tag in WordPress is to use Yoast SEO plugin.
When you activate Yoast SEO it will automatically add a self-referencing canonical URL for all pages.
To change the canonical URL of a page or post, edit the particular page and click ADVANCED and set the canonical URL.
How to set canonical URLs in any CMS?
For non-WordPress websites you need to add in the HEAD section of all your pages a rel="canonical"
link attribute that has the following format:
<link rel=”canonical” href=”CANONICAL-URL”/>
Replace CANONICAL-URL with the actual URL you want a page to point to. This can be the same URL as the page or a valid URL of a page within your website or to a different domain (cross-domain canonical).
Resources to learn more about canonical URLs
If you want to learn more about canonical URLs, you can read the following resources:
- Consolidate duplicate URLS – Advice from Google on the use of canonical URLs
- Canonical Link Element – Wikipedia Article
- Troubleshooting canonical URLs
- How does Google Pick a canonical URL (Video)
- Canonical URL Checker (Tool)
Key Learnings
Technical SEO best practices indicate that each and every page of your site needs to have a canonical tag set. It should either point to itself or to a valid URL on your site.
If you’re on WordPress, install the Yoast SEO plugin to automatically set self-referencing canonical tags and then go to individual pages and change the canonical URL if needed.
A canonical URL behaves the same way as a 301 redirection when it comes to consolidating links and PageRank. Use a 301 redirection when you want a page not to be visible by users.
If you run an ecommerce shop, make sure that any dynamically generated pages have canonical URLS pointing to static pages of your site.
If you have accelerated mobile pages (AMP) enabled on your site check that the canonical tags of every page point to the non-amp version.
John Koch says
Having been blogging for three years, i have never understand the use and best practices of canonical URL for SEO until now. For 301 redirects, i used to use it frequently.
Bytheway, Thank you for making this guide simpler and well explained, Alex.
Do have a great day ahead
Sudhir says
Really a wonderful information, you shared.
Actually I was searching for “How to set canonical URLs in WordPress?”
And I found this information here.
Thanks a lot 🙂