Trang chủ Onpage SEO What is Canonical url? The importance of optimizing Canonical tags for URLs

What is Canonical url? The importance of optimizing Canonical tags for URLs

bởi Nguyễn Thành Tiến

What is a Canonical URL has been a familiar concept to many SEOs. This is an effective solution to the problem of duplicate content. So how to use Canonical Tag to make the website to the Top? Check out this article!

Using canonical tags in SEO

Instructions on how to use Canonical Tag

What are Canonical URLs?

The canonical tag (also known as “rel canonical”) is a piece of HTML code that declares the original URL of pages with duplicate content to search engines. Use Canonical Tag in case of duplicate or similar content on different URLs.

Learn What is a Canonical URL tag?

What are Canonical URLs?

Using the canonical tag helps prevent problems caused by identical or “duplicate” content appearing on multiple URLs. Practically speaking, the canonical tag specifies to search engines which version is the major version that should be indexed.

The Standard Structure of a Canonical Tag

Canonical tags use a simple, consistent syntax and are placed in the <head> section of the web page. Eg

<link rel = “canonical” href = “” />

An example of Moz .'s Canonical tag

An example of Moz .’s Canonical tag

Here’s what each part of the Canonical URL snippet means :

  • link rel = “canonical” : The link in this tag is the main (canonical) version of this page.
  • href = “” : The canonical version can be found at this URL.

Why are Canonical tags important in SEO?

Google really doesn’t like duplicate content. It makes it difficult for Google to choose:

  • Which version of the page needs Index
  • Which version to rank for queries.
  • Whether to consolidate “link equity” on one page or split it into multiple versions.

Websites with many pages with duplicate content affect the “crawl budget”. Google will take time to crawl duplicate versions instead of discovering other important content on the website.

Duplicate content can affect Google's crawl budget

Duplicate content can affect Google’s crawl budget

Canonical tags help you solve all these problems. They are responsible for telling Google which website’s URLs should index and rank, as well as where to consolidate “link equity”.

If you don’t specify a Canonical URL, Google will determine for itself which root URL is best to index. However, relying on Google is not a great idea. Because Google may choose an unwanted URL as the original URL.

Rules to remember when using Canonical Tag

There are many ways to implement Canonical Tag , but no matter which way you choose, there are 5 rules to follow.

Use absolute path

Google’s John Mueller said it’s best not to use relative paths with the rel=”canonical” link element.

Therefore, you should use the structure:
<link rel=”canonical” href=” ” />

Instead of this structure:
<link rel=”canonical” href=”/sample-page/” />

Use lowercase for URLs

Google considers uppercase and lowercase URLs to be two different versions of URLs. Therefore, you should lowercase URLs on the server as well as for Canonical tags.

Use the correct version of HTTPS or HTTP

If you’re switching to SSL, make sure you don’t declare any non-SSL (i.e. HTTP) URLs in the Canonical tag . Theoretically, doing so could lead to confusion and unexpected results.

If you’re on HTTPS make sure to use the correct version:
<link rel=”canonical” href=”” />

If you don’t use HTTPS use this version:
<link rel=”canonical” href=”” />

Use a Canonical Tag Self-Referencing

Google’s John Mueller says that while not required, self-referencing Canonical tags are preferred.

John Mueller recommends using the self-referencing Canonical tag because it helps Google clearly understand what page you want to index and what the URL is when indexed. Even if you have a single page or have different variations of the URL, it is still possible to pull it up.

For example, with parameters at the end, can be uppercase, lowercase, or www and not www. All of these can be addressed with a relative Canonical tag.

Basically, the Canonical tag on a page points to itself.

For example, if the URL was, the self-referencing Canonical on that page would be:
<link rel=”canonical” href=” ” />

Most modern popular CMSs automatically add self-referencing URLs. But if you use a custom CMS then a web developer hardcode will be required.

Each page uses only one Canonical Tag

If the page has more than one Canonical tag , Google will ignore all those Canonical tags . That is, with multiple declarations of rel = canonical , Google will ignore all suggestions for rel = canonica l.

Canonical Tag Deployment Guide .

Install Canonical Tag with HTML tag rel=”canonical”

Using the rel=canonical tag is the simplest and cleanest way to specify a root URL.

To do the installation simply add the following code to the <head> section of any duplicate pages:

<link rel = “canonical” href = “” />

Let’s say you own an e-commerce website that sells t-shirts. You want to be the original URL, even if its content is accessible via other URLs (for example, /black-tshirts/). Then just add the following canonical tag to any duplicate pages:

<link rel = “canonical” href = “” />

If you are using CMS then there is no need to worry about the code of the website.

Install Canonical tags in WordPress

Yoast SEO settings and self-referencing Canonica l tags will be added automatically. To customize the settings, use the “Advanced” section on each post or page.

Install Canonical Tag in Wrodpress

Install Canonical Tag in Wrodpress

>>See more: Instructions for installing and using the simple Yoast SEO Plugin

Install Canonical tags in Shopify

Shopify adds self-referencing Canonical URLs to products and blog posts by default. To set custom Canonical URLs, you need to edit the template files (.liquid) directly.

Install Canonical tags in Squarespace

Squarespace also adds self-referencing Canonical URLs by default. However, as is the case with Shopify, you need to edit the code directly if you want to add a custom Canonical URL.

Setting Canonical Tag in HTTP header

For documents like PDF, there is no way to put Canonical tags in the page title because there is no <head> page part . In such cases you will need to use HTTP headers to set the canonical. You can also use Canonical in HTTP headers on standard web pages.

For example you create a PDF version of this blog post and store it in the blog’s subdirectory (*). The structure of the HTTP header line in the PDF file is as follows:

HTTP/1.1 200 OK
Content-Type: application/pdf
Link: <>; rel = “canonical”

Install Canonical Tag in sitemap

You should only list canonical URLs in your sitemap. That’s because Google considers the pages listed in the sitemap to be the recommended canonical pages.

However, Google does not always choose the URL in the sitemap as the canonical.

Google says that we do not guarantee that the URLs in the sitemap will be considered canonical. But it’s a simple way to define canonical pages for a large site. Sitemaps are a useful way to let Google know which pages you consider the most important on your website.

>>Learn more: What is a Sitemap ? How to create a sitemap for a website

Install Canonical Tag with Redirect 301

Use 301 redirects when you want to redirect traffic away from the duplicate URL and to the original URL.

Let’s say your page has the following URLs:


Choose a root URL and redirect other URLs to the original URL.

You should also do the same for HTTPS or HTTP and www or non-www versions of your website. Select a canonical version and redirect others to it.

For example, the canonical version of is a non-www HTTPS URL ( ). The following URLs all redirect there:


Install Canonical Tag with Internal Link

The way you link from one page to another throughout your site is a Canonical URL way .

Google Webmaster Trends Analyst John Mueller covers the signals used to determine Canonical URLs in this video.

How Google Collects Canonical Tags

The more consistent you are with all of these signals, the easier it will be for search engines to determine your preferred Canonical URL . As John mentioned in the video, Google also favors HTTPS over HTTP URLs and nicer URLs.

>>Refer to the article: What is Internal Link ? Do Internal Links Affect SEO Rankings?

Mistakes to avoid when using the rel=”canonical” tag

Canonicalization is a somewhat complicated subject. As such, there are many misunderstandings and misconceptions about how to use Canonical properly. Here are some common mistakes people make when trying to standardize:

Block canonicalized URLs via robots.txt

Blocking a URL in robots.txt prevents Google from crawling, which means that Google can’t see any Canonical tags on that page. This makes it impossible for Google to transfer any “link equity” from Non-Canonical to Canonical.

Set the canonical URL to “noindex”

Noindex and rel=canonical should not be combined because they are two different factors. Google will often favor the Canonical tag over the “noindex” tag, as John Mueller said here. If you want to prevent Indexing and Canonical of a URL, use Redirect 301. Otherwise, use rel = canonical .

Set HTTP status code 4XX for Canonical URL

Setting the HTTP 4XX status code for a Canonical URL has the same effect as using the “ noindex” tag . Google won’t be able to see the Canonical tag and switch “link equity” to the standard version.

Canonicalizing all paginated pages to the original page

Paged pages should not implement the Canonical URL L to the first paginated page in the series. Instead, self-referencing standards should be used on all paginated pages.

As Google’s John Mueller stated on Reddit, this is an improper use of rel=canonical . Since this post is about canonicalization, using rel=canonical on page 2 points to page 1. Page 2 is not equivalent to page 1, so such rel=canonical would be incorrect.

You should also use the rel = prev / next tag for pagination . These are no longer used by Google, but Bing still uses .

Don’t use canonical tags with hreflang

The Hreflang tag is used to specify the linguistic and geographic targeting of a web page. Google advises that when using hreflang, you should “specify a canonical page of the same language, or preferably an alternative language if the page is not in the same language.”

There are many rel=canonical tags

Having multiple rel=canonical tags will cause Google to ignore them all. This happens because tags are inserted into the system at different points, such as CMS, themes, and plugin(s). This is why many plugins have an override option to ensure that they are the sole source for Canonical tags.

Also, this could be a matter of installing Canonical using JavaScript. If you have no Canonical URL specified in the HTML response and then add the rel=canonical tag with JavaScript, it will be displayed on the page by Google.

However, if you have a canonical page specified in HTML and swap out the preferred version with JavaScript, it will make it difficult for Google to understand your site.

Rel = canonical trong <body>

Rel=canonical should only appear in the <head> section of the post. The Canonical tag in the <body> section of the page will be ignored.

While a page’s source code can have a rel=canonical tag, when the page is actually generated in the browser or rendered by a search engine, various things like the tag not being closed, JavaScript being inserted, or < iframes> in the <head> can cause the <head> to end prematurely during rendering.

In these cases, a Canonical tag could be inadvertently included in the <body> of a rendered page that would not be approved.

>> Reference article: What is Onpage SEO ? The role of Onpage SEO optimization for the website

Frequently asked questions about Canonical Tag

Where should I put the Canonical Tag?

Canonical Tag is placed in the <head> tag of the HTML in the website. It tells search engines which URL is the canonical version of the page being displayed.

How to create a Canonical link in HTML?

Using the rel=canonical tag is the simplest and most obvious way to specify a Canonical.

Do canonical tags affect SEO?

Canonical Tag not only directly affects how search results show C, but also affects the overall ranking of a website due to many factors, such as structure, user experience, and PageRank flow.

Should all websites have a Canonical tag?

All pages (including canonical pages) must contain a Canonical tag to prevent any possible duplication. Even if there is no other version, the page must still have a Canonical Tag linking to itself.


Above is a complete knowledge of what a Canonical URL is and how to properly implement Canonical Tag. Proper and proper use of Canonical will be a plus point for Google to appreciate your website. Hope this article will give you a lot of useful knowledge.

Bình luận về bài viết
Bạn ơi, bài viết hữu ích với bạn chứ?  
Đánh giá bài viết này

No comments yet

Bài viết liên quan