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 a canonical URL is and how to use Canonical URLs correctly.
What Is a Canonical URL?
A canonical URL is a special tag (rel=“canonical”) added in the HEAD section of a page and specifies the preferred version of a set of web pages with highly similar or duplicate content. By specifying a canonical URL, you can tell search engines which version of a page to prioritize when indexing. This is crucial for avoiding issues with duplicate content, which can negatively impact a site's SEO performance.
For example, if you have two similar pages on your website, such as "example.com/page" and "example.com/page?sort=alpha," you might want to inform search engines that they should treat these as the same page. By designating one of these URLs as the canonical version, you guide search engines to index your preferred page and attribute all relevant ranking signals (like links) to this 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.
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.
- Enables you to 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 while avoiding crawling pages with duplicate content.
How Do You Find The Canonical URL of Any Page?
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 a page use one of the methods below:
1. 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.
2. 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’, 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 To Use Canonical URLs?
The most important reasons for using canonical URLs are:
1. Avoid Duplicate Content Issues
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 use 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.
2. When Syndicating Content
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.
3. To Specify Your Preferred Domain to Google
A website accessible through different URLs (with www or without www, with Http and Https) is considered by Google to be a different website.
Google can get confused about which version to index, and to help them with this task, you need to specify your preferred domain. Canonical tags are the only way to tell Google what your preferred domain is.
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
Here are a couple of examples to help you understand how to set your canonical tags.
Pages With Similar Content
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., pointing to the page itself.
<link rel="canonical" href="https://www.reliablesoft.net/seo-course"/>
This way, you tell Google which page to add to their index and show it 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 you have a category page displaying 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 choose the color of a filter https://www.reliablesoft.net/products/shoes/?color=white
Both pages have exactly the same content. The only difference is that the product images show shoes in white 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 pointing to the page itself or another 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 with 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 a canonical URL that specifies the preferred domain.
- All canonical URLS should follow the same format as the homepage.
Canonical Tags Vs. 301 Redirections
When you set 301 redirections, 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.
How To Define Canonical URLs?
WordPress
The easiest way to specify the canonical tag in WordPress is to use the Yoast SEO plugin.
When you activate Yoast SEO will automatically add a self-referencing canonical URL for all pages.
To change a page's or post's canonical URL, edit the particular page, click ADVANCED, and set the canonical URL.
Any other 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).
Key Learnings
indicate that every site page needs to have a canonical tag set. It should either point to itself or 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 like a 301 redirection when consolidating links and PageRank. Use a 301 redirection when you want a page not to be visible to users.
If you run an e-commerce shop, make sure that any dynamically generated pages have canonical URLS pointing to static pages of your site.
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)