freeseobot

Canonical Tags Explained: Fix Duplicate URLs in Google

What a canonical tag does, the three ways to set one, the mistakes Google warns about, and how to check which URL Google actually chose for your page.

By freeseobot Editorial · Published · 6 min read

A canonical tag tells Google which URL is the main version of a page when the same content is reachable at more than one address. It is a hint, not a command. Google's documentation says that even if you name a canonical page, Google "might choose a different canonical." Your job is to send clear, consistent signals so its choice matches yours.

This guide covers what canonical URLs are, the three methods Google lists for setting them, the mistakes to avoid, and how to check the result in Search Console.

What is a canonical URL?

A canonical URL is the address Google treats as the main copy of a page. Many sites serve one page at several addresses without meaning to. Common causes:

  • http:// and https:// versions of the same page
  • www and non-www versions
  • Tracking parameters, such as ?utm_source=newsletter
  • Sort and filter parameters on product or blog lists
  • A trailing slash and a no-slash version

Google groups these near-identical URLs into a cluster, picks one to show in results, and treats the rest as alternates. If you do not guide that choice, Google picks for you. The risk is that it picks an address you did not intend, such as a parameter URL, and your analytics and links get split across versions.

What are the ways to set a canonical URL?

Google's guide to consolidating duplicate URLs ranks the methods by strength. You can combine them, and none is required.

Method Strength per Google Use it when
Redirect "A strong signal" that the target should be canonical You are retiring the duplicate page
rel="canonical" link "A strong signal" Both pages must stay reachable
Sitemap inclusion "A weak signal" You want to back up the other two

Put one line in the <head> of the duplicate page, pointing to the preferred URL:

<link rel="canonical" href="https://example.com/guides/canonical-tags/" />

You can also send it as an HTTP header. Google says the header form is for web search only and suits files that have no HTML, such as PDFs. Pick one of the two methods and stay with it. Google's wording: "We recommend that you choose one of these and go with that."

Redirects

If the duplicate does not need to exist, redirect it to the main page. Google calls a redirect a strong signal that the target should become canonical. Use a permanent redirect when you are deprecating the duplicate. Our guide on 301 vs 302 redirects explains which type to choose.

The sitemap

Listing a URL in your XML sitemap is a weak signal, but it helps the listed URLs become canonical. Only list the versions you want indexed. See the XML sitemap guide for what belongs in the file.

What rules should I follow?

These come straight from Google's documentation:

  1. Use absolute URLs. Google says to "use absolute paths rather than relative paths" in the canonical element. Relative paths are supported but not recommended.
  2. Add a self-referential canonical. The preferred page should carry a rel="canonical" link that points to itself.
  3. Do not mix signals. Do not name one canonical in the tag and a different URL in the sitemap.
  4. Link to the canonical. Your internal links should point to the preferred URL, not to the duplicates. The internal linking guide shows how to audit this.
  5. Skip URL fragments. Google generally does not support fragments (the part after #) as canonical targets.
  6. Keep the language the same. Canonical pages should be in the same language as the page that points to them, or the closest available substitute. For regional versions, use hreflang annotations.
  7. Put it in the HTML source. On JavaScript sites, Google prefers the canonical in the HTML. If you must set it with JavaScript, make sure the script does not change an existing canonical element.

Google also says it prefers HTTPS pages over equivalent HTTP pages as canonical, unless something is wrong, such as an invalid certificate or a redirect from HTTPS to HTTP.

What should I not use for canonicalization?

Google names three things to avoid:

  • robots.txt. The documentation says: "Don't use the robots.txt file for canonicalization purposes." Google may still index a disallowed URL without its content.
  • The URL removal tool. It hides all versions of a URL from Search, so it does not choose a main version.
  • noindex. Google does not recommend it for choosing a canonical within one site, because it blocks the page from Search entirely. Use rel="canonical" instead.

What are the most common canonical mistakes?

Google's canonicalization troubleshooting page lists the following causes of wrong canonicals:

  • Plugin or CMS errors. Software can point canonicals or redirects at unintended URLs. Check the HTML your pages actually output, not the settings screen.
  • Regional versions without hreflang. Sites serving substantially the same content to different regions should use hreflang.
  • Misconfigured servers. A server may return content from one domain for another, or unrelated servers may return identical soft 404 pages.
  • Hacked pages. Attacks can inject canonical tags that point to spam URLs.
  • Syndicated content. Google does not recommend the canonical element for avoiding syndication duplicates. The page says the most effective fix is for partners to block indexing of your content.
  • Copied content. If another site copies you without permission, contact its host, or file a DMCA request with Google.

How do I check which canonical Google chose?

Use the URL Inspection tool in Google Search Console. It shows the canonical Google selected for a page. Then follow this routine:

  1. Inspect the page and compare Google's chosen URL with the one you declared.
  2. Ask whether Google's choice "makes more sense" for users than yours. Sometimes it does.
  3. Open the page source in your browser and look for stray rel="canonical" elements or 3xx redirects.
  4. Make clustered pages meaningfully different if they should be separate. Google says pages can stay in a duplicate cluster for "up to two weeks" after content fixes.
  5. Use "Request Indexing" only for your most important URLs, because it has quotas.

If a page is missing from Google altogether, the cause may be different. Read why isn't my page indexed for every Search Console status.

Check your own site

The freeseobot SEO checker crawls your pages and reports pages with no canonical URL, which is the most basic gap. Run it once, fix the pages it lists, and re-run it after any theme or plugin change. Plugin updates are a common way for a working setup to break.

Questions

Does a canonical tag stop duplicate content problems?

It helps Google choose one version to show. Without it, Google still picks one, but you do not control which. The documentation we read does not describe a penalty for duplicate URLs, so we do not claim one.

Should every page have a canonical tag?

Google recommends a self-referential rel="canonical" on the preferred page. It costs one line and removes ambiguity if a parameter URL of that page appears later.

Can I use a canonical tag across two different domains?

Google's page on canonical methods does not rule it out, but its only cross-site advice we confirmed is about syndication: it does not recommend the canonical element there, and says the most effective fix is for partners to block indexing of your content.

Why did Google ignore my canonical tag?

Because it is a strong signal, not a rule. Other signals may point elsewhere: redirects, sitemap entries, internal links, or HTTPS versus HTTP. Make all of them agree, then check URL Inspection again.

Is a canonical tag the same as a 301 redirect?

No. A redirect sends visitors and Googlebot to another URL. A canonical tag leaves both URLs reachable and only names the preferred one.

Sources

More guides