← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Canonical URL (rel=canonical)

frontend Intermediate

Also Known As

rel canonical canonical link canonical tag canonical href canonical link element

TL;DR

A <link rel='canonical'> tag that tells search engines which URL is the authoritative version of a page — preventing duplicate content from splitting ranking signals across multiple URLs.

Explanation

Duplicate content arises when the same or very similar content is accessible at multiple URLs — example.com/page, www.example.com/page, example.com/page?ref=newsletter, example.com/page/ (with trailing slash). Without canonical, search engines may index all variants as separate pages, splitting link equity and confusing ranking. The canonical element (introduced 2009 by Google, Yahoo, and Microsoft) signals the preferred URL. Rules: must be an absolute URL including scheme and domain; should be self-referencing on canonical pages; paginated pages should have self-referencing canonicals unless you intentionally want pagination excluded from indexing. Canonical is a strong signal, not a directive — Google may override it if the canonical and current page have significantly different content.

Common Misconception

Setting all paginated pages to canonical='/page/1' consolidates SEO — it actually tells Google to de-index pages 2 onwards; paginated pages should have self-referencing canonicals unless you want them excluded from search results.

Why It Matters

E-commerce sites often have hundreds of URL variants per product (colour, size, sort, tracking parameters) — without canonical, link equity is fragmented across all variants instead of consolidating on the primary product URL, directly reducing ranking potential.

Common Mistakes

  • Relative canonical URL (/page/) — must be absolute (https://example.com/page/); relative canonicals may be ignored by Google.
  • All paginated pages pointing canonical to page 1 — de-indexes pages 2+ which may contain unique content.
  • Missing canonical on every page type — even the homepage needs a self-referencing canonical to handle www vs non-www variants.
  • Canonical pointing to a redirecting URL — canonical should point to the final destination URL, not an intermediate redirect.

Avoid When

  • Do not use canonical as a substitute for a 301 redirect — if a page has moved permanently, redirect it.
  • Do not point paginated pages to page 1 unless you intentionally want pagination excluded from search results.

When To Use

  • Add a self-referencing canonical to every page as standard practice.
  • Use canonical to point URL parameter variants (tracking, filters) to the clean canonical URL.
  • Use cross-domain canonical when your content is syndicated — point from the syndicated copy to the original.

Code Examples

✗ Vulnerable
<!-- Relative canonical — may be ignored -->
<link rel="canonical" href="/products/blue-mug">

<!-- All paginated pages pointing to page 1 -->
<!-- On /products?page=3: -->
<link rel="canonical" href="https://example.com/products">
✓ Fixed
<!-- Self-referencing absolute canonical on every page -->
<link rel="canonical" href="https://example.com/products/blue-mug">

<!-- Paginated: self-referencing on each page -->
<!-- On /products?page=3: -->
<link rel="canonical" href="https://example.com/products?page=3">

<!-- Product with URL parameters: canonical to clean URL -->
<!-- On /products/blue-mug?ref=newsletter&utm_source=email: -->
<link rel="canonical" href="https://example.com/products/blue-mug">

Added 6 Apr 2026
Views 40
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 1 ping T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 2 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T
No pings yet today
SEMrush 4 Google 2 ChatGPT 1 Perplexity 1 Ahrefs 1
crawler 9
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Low
⚡ Quick Fix
Add <link rel='canonical' href='https://example.com/exact-page-url'> with absolute URL to every page <head>
📦 Applies To
html web
🔍 Detection Hints
Missing <link rel='canonical'> in <head> or relative href value
Auto-detectable: ✓ Yes screaming-frog sitebulb google-search-console
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Low ✗ Manual fix Fix: Low Context: File

✓ schema.org compliant