How to Add Canonical Tag? – A Complete Guide

How to Add Canonical Tag? - A Complete Guide

When a page appears on your website in multiple versions, the canonical URL is the address of the primary version of the page. With a canonical tag in your HTML, you may specify the canonical URL. Google can then distinguish between this page and the duplicate pages when it crawls the page.

Canonical URLs are important to SEO, thus determining them is essential. Canonical URL implementation done correctly can raise the ranking of your website on Google and other search engines. In this article, you will learn about canonical tags and how to add a canonical tag to the page.

What are Canonical Tags?

How to Add Canonical Tag? - A Complete Guide

A canonical tag, also known as “rel=canonical”, is a concise part of HTML code that enables search engines to distinguish between the “primary” version of a website and all other sites that are either identical to it or very similar to it.

In SEO, canonical tags are used to aggregate link equity from duplicate sites, tell Google which version of the page you want to appear in search results, and enhance the search crawlers to crawl and index the page of your website.

Importance of Canonical Tags

Search engines like Google avoid duplicate material. It makes their decision-making more challenging:

  • Which version of a page should be indexed (there will only be one!)
  • which variation of a page should be ranked for relevant queries?
  • if “link equity” should be divided among a few versions or consolidated on one page.

Your “crawl budget” may also suffer if there is too much duplicate content. As a result, Google can end up wasting time crawling numerous copies of the same page rather than finding other valuable information on your website.

Canonical tags address each of these problems. They enable you to instruct Google regarding which version of a page to index, rank, and consolidate any “link equity.”

If a canonical URL is not provided, Google will handle the situation on its own. It’s not a good idea to rely completely on Google in this way. They might choose a version of your page that you don’t want to be the canonical version.

How to Add Canonical Tag?

It’s really simple to add rel=”canonical” tags to your pages; just go to any duplicate webpage and do so in the <head> section. The primary, original version should be the destination of the link in the canonical tag.

Implementing canonical tags one page at a time is preferable. With larger websites, this can be impossible or take a lot of time and resources. Thankfully, canonical tags can also be applied automatically by using a variety of plugins, including Yoast SEO (for WordPress).

It’s rather simple to implement canonical tags with this plugin:

  • Choose the page to be canonicalized.
  • Go to the page’s “Advanced” section.
  • Provide the canonical URL you want to use as a reference.

Adding Canonical Tags using HTML header

Adding Canonical Tags using HTML header

You can also add a canonical tag to your webpage by using an HTML header.

Since there is no <head> section in special non-HTML documents like PDFs where you could include a canonical tag, this is particularly helpful for them.

You must visit your website’s .htaccess file and add the canonical tag to implement canonical tags in the HTTP header.

The Best Practices for Canonical Tags

Utilize Self-referencing Canonicals

Even if you did not use canonical tags on the other duplicate pages, it is always a good practice to place a canonical tag on a page that points to itself.

Search engines like Google are informed that the main, original pages are the canonical versions when self-referencing rel=canonical is used on them.

Use Absolute URLs

You can prevent unintentional errors or incorrect canonical URL interpretations by search engines by using absolute URLs in canonical tags (as opposed to the relative URLs).

Moreover, absolute URLs need to have HTTPS, //, www, and trailing slashes (if possible).

Use Lowercase in URLs

The use of capital letters and lowercase letters in URLs might be important to search engines like Google. To preserve consistency and avoid duplicate content issues in the eyes of search engines, canonical URLs should be written in lowercase.

Try to utilize lowercase URLs on your servers and use them for the canonical tags as a good practice.

Canonicalize Cross-domain Duplicates

Not just from your website, but also from other domains, canonical tags can refer to your major pages.

If you have duplicate content on pages on another website (such as an article that has been reused on a news website), you should:

  • Use the canonical tag, which references itself, on your primary page
  • Use the canonical tag to point to your original page from an external one

What to Avoid with Canonical Tags?

Nobody is flawless. Hence, you might occasionally make a mistake with your canonical tags.

Here are the most frequent mistakes people make while canonicalizing their URLs:

  • Pages with multiple Canonicals: The presence of multiple canonical tags on a page may cause the search engine to become confused and ignore the canonical signal, so pay attention to them.
  • Avoid Canonicals on non-duplicates: While using canonical tags, you should always make sure that the content on the duplicate pages and the main version of the page is either identical or at least very similar.
  • Canonicals On Paginated pages: Paginated pages have content that is dispersed across multiple pages. In this case, you should never refer to page “1” from the other paginated pages; instead, you should always use self-referencing canonical tags on each page.
  • Avoid the use of canonical in the <body>: Canonical tags should never be used anywhere else in the HTML text than the <head> section of your sites.

 how to add canonical tag

  • Avoid canonical loops and Chains: Canonical loops should be avoided at all costs by using canonical tags that point directly to the main page (similar to the redirect loops).


Canonical tags are an important tool for managing duplicate content on a website. They help search engines understand which version of a page is the preferred one to index and display in search results, which can improve a website’s overall search engine visibility and rankings.

By properly implementing canonical tags, website owners can ensure that their content is being properly crawled and indexed by search engines, and avoid any negative impact on their SEO efforts. Overall, the use of canonical tags should be considered a best practice for any website looking to optimize its online presence.