SEO
Canonical URLs: What rel=canonical Does and When to Use It
Key takeaways
- Google treats redirects and rel=canonical as strong canonical signals and sitemap inclusion as a weak one.
- Put a self-referencing, absolute-URL canonical in the head of the page you want indexed.
- Pick one method and keep all signals pointing to the same URL; mixed signals cause surprises.
- Google may choose a different canonical than you declare; check the URL Inspection tool.
- Do not use noindex or robots.txt to choose between duplicates.
What is a canonical URL?
A canonical URL is the address you want search engines to treat as the main version when several URLs show the same or very similar content. Google's documentation says you can specify one to control which URL appears in results, consolidate signals such as links onto one address, simplify metrics, and avoid spending crawl time on duplicates. Google also notes that none of the methods are required, because it will often pick a canonical on its own. The goal of this article is to help you make that choice deliberately rather than leave it to chance.
The idea predates Google's guidance. RFC 6596, the standards document for the canonical link relation, describes it as a way for an author to name the preferred address among duplicates, such as URLs that differ only by session IDs or parameters. It says the preferred address can be processed in place of the duplicates and used to consolidate properties like link popularity.
How do duplicate URLs happen?
Duplicates are usually accidental. Google's guide gives examples such as tracking parameters appended to a URL and the same page served on more than one hostname. Other common sources include HTTP and HTTPS versions, with and without a trailing slash, and printer-friendly or filtered views. A visitor sees one page, but a crawler sees several addresses.
Which method should you use?
Google lists three approaches and describes how strongly each one signals your preference:
- Permanent redirects are a strong signal that the target should be canonical. Google recommends them when you are retiring a duplicate, and says server-side redirects act fastest.
- The rel="canonical" annotation is also a strong signal. You can set it as a link element in the page's head, or as an HTTP Link header, which also works for non-HTML files such as PDFs.
- Sitemap inclusion is a weak signal. Google still decides which pages are duplicates based on content similarity.
In practice, a redirect fits when the duplicate does not need to exist for visitors, and a canonical tag fits when both URLs must keep working, such as a campaign link with tracking parameters. Google says the methods can be combined to strengthen the preference.
How do you write a rel=canonical tag correctly?
Google's guidance on the link element gives several concrete rules.
- Place it inside the head section. Google says the element is only accepted there, and invalid head markup can also cause it to be ignored.
- Use an absolute URL, including the protocol and hostname, rather than a relative path. Relative paths are supported but can cause problems later, for example if a test site gets crawled by mistake.
- Add the same self-referencing canonical to the canonical page itself.
- Do not point to a URL fragment.
- Do not add attributes such as hreflang, lang, media, or type to the canonical tag; Google says they are ignored for this purpose. Use alternate annotations for language variants instead.
An example is <link rel="canonical" href="https://www.example.com/page/">. If your pages are rendered with JavaScript, Google advises setting the canonical in the HTML source where possible and avoiding changing it with scripts.
What mistakes cause canonical problems?
The same Google page warns against sending conflicting signals, for instance an HTTP header and an HTML tag that point to different URLs, or a sitemap listing one address while the tag names another. It also advises against using the robots.txt file or the URL removal tool for canonicalization. It says not to use noindex to pick between duplicates on your own site, because that removes the page from Search entirely. Finally, it recommends linking internally to the canonical version so your own navigation supports the choice.
Google also states that it prefers HTTPS over HTTP in most cases, so redirecting HTTP to HTTPS and keeping HTTP addresses out of sitemaps helps.
What if Google picks a different canonical?
This can happen. Google's troubleshooting guide says Google may choose a different canonical than the one you declare, based on content quality or technical signals. It recommends checking the URL Inspection tool in Search Console to see which page Google considers canonical, then looking for causes: language variants without localization annotations, incorrect canonical elements or redirects added by a CMS or plugin, server misconfigurations, hacked pages that inject cross-domain canonicals, syndicated content, or copycat sites.
The guide adds that Google may keep pages in a duplicate cluster for up to two weeks after fixes, and that making pages meaningfully different helps them separate faster. After a fix, you can use Request Indexing for your most important URLs, keeping in mind it has quotas.
A simple checklist
Choose one preferred URL per page, redirect true duplicates to it, add a self-referencing absolute canonical to the page, link internally to that version, list only that version in your sitemap, and then spot-check with URL Inspection. Google does not publish a guarantee that it will always honor your choice, so treat the canonical as a strong preference you are making as clear as possible.
Frequently asked questions
Is rel=canonical a command or a hint?
Google calls it a strong signal rather than a command. It also says none of the canonicalization methods are required and that Google decides which pages are duplicates, so your declared canonical can be overridden.
Should every page have a self-referencing canonical?
Google recommends adding a self-referencing rel=canonical to the canonical page itself. It is a low-effort way to make your preferred URL explicit.
Should I use a redirect or a canonical tag?
Google says permanent redirects are a strong signal and suit retiring a duplicate. A canonical tag suits cases where both URLs must keep working, such as tracking-parameter links.
Can I use noindex to handle duplicate pages?
Google advises against it for choosing a canonical within your own site, because noindex removes the page from Search entirely.
Sources
- What is URL canonicalization (Consolidate duplicate URLs) — Google Search Central
- Troubleshoot canonicalization issues — Google Search Central
- RFC 6596: The Canonical Link Relation — IETF / RFC Editor
Keep reading
See how AIrecommend.ai helps businesses get found and recommended by AI assistants.