By SitemapFixer Team
April 2025 · 7 min read

Canonical URL: What It Is and How to Set It Correctly

Check canonical issues in your sitemap freeAnalyze My Site Free

Canonical tags are the primary technical tool for managing duplicate content — but they're also one of the most misused elements in on-page SEO. Implemented correctly, they consolidate ranking signals to your preferred URL; implemented incorrectly, they silently deindex pages you meant to rank. This guide covers everything from self-referencing canonicals to cross-domain syndication and the edge cases where Google ignores your canonical entirely.

What a Canonical Tag Does

A canonical tag is an HTML element in a page's head section that tells search engines which URL is the 'preferred' or 'master' version of that page. When Google sees link rel=canonical href=https://example.com/page, it treats that URL as the one to index and rank, even if it crawled the page from a different URL. Canonical tags are the primary tool for managing duplicate content without 301 redirects.

Self-Referencing Canonicals

Best practice is to add a self-referencing canonical to every page - a canonical tag that points to the page's own URL. This prevents Google from picking an unexpected canonical if it discovers your page through a different URL (e.g., with UTM parameters appended). In Next.js, set alternates.canonical in every metadata object. In WordPress with Yoast or RankMath, the plugin adds self-referencing canonicals automatically.

Common Canonical Tag Mistakes

Canonical pointing to wrong domain: after a site migration, old canonical tags pointing to the previous domain may persist. Google indexes the old domain. Always audit canonicals after any migration. Canonical on paginated pages pointing to page 1: this tells Google pages 2, 3, 4 are all duplicates of page 1 and deindexes them. Paginated pages should have self-referencing canonicals, not page-1 canonicals. Noindex + canonical conflict: a page with both noindex and a canonical tag sends contradictory signals - Google may choose to respect noindex and ignore the canonical entirely.

Canonical vs 301 Redirect

A 301 redirect is a stronger signal than a canonical. When you genuinely want to consolidate two pages into one, use a 301 redirect from the unwanted URL to the preferred URL. Canonical tags are for managing which version Google indexes when you need both URLs to remain accessible - for example, keeping filtered URLs accessible for users while canonicalizing them to the main category page for SEO. If you can use a 301, prefer it over a canonical.

Checking Canonical Tags at Scale

Use Screaming Frog to crawl your site and export all canonical tags. Look for: pages where the canonical points to a different domain, pages where the canonical is empty, pages where the canonical and URL do not match but you expect them to, and paginated pages where the canonical should be self-referencing but is not. SitemapFixer analyzes URLs in your sitemap and flags patterns suggesting canonical tag issues.

Cross-Domain Canonicals

Canonical tags can point to a completely different domain - this is called a cross-domain canonical. Publishers use them when syndicating content: you publish an article on a partner site but add a canonical pointing back to the original on your domain. Google generally respects cross-domain canonicals, but they are a strong signal that you are intentionally deferring authority to another site. Never add a cross-domain canonical accidentally - always verify the canonical URL is on your own domain unless you are deliberately syndicating.

Canonical Tags and Hreflang Interaction

For multilingual sites using hreflang, canonical and hreflang tags must be consistent. Each language or regional variant should have a self-referencing canonical, not a canonical pointing to another language version. If your Spanish page has a canonical pointing to the English page, Google treats the Spanish page as a duplicate of the English page and may not index it - completely defeating the purpose of your hreflang implementation. Audit both hreflang and canonical tags together during any international SEO audit.

When Google Ignores Your Canonical

Google treats canonical tags as hints, not directives. It will override your canonical if: the canonicalized URL returns a non-200 status code, the two pages are not actually similar enough in content, there are conflicting signals (e.g., the page you canonicalize to also has a different canonical), or one version has significantly more external links. If Google keeps choosing a different canonical than you specified, diagnose the underlying signal conflict rather than fighting the hint.

Canonical Tags in HTTP Headers

Like noindex, canonical can be set via HTTP Link header rather than HTML: Link: rel=canonical href=https://example.com/page. This is useful for non-HTML files like PDFs - you can canonical a PDF to its HTML equivalent page. HTTP header canonicals have the same weight as HTML canonical tags. Check both when auditing, since the HTML source won't reveal header-level canonicals. The Network tab in Chrome DevTools or a curl -I request shows HTTP headers.

Sitemap URLs Must Match Canonical URLs

Every URL in your XML sitemap should be the canonical version of that page. If your sitemap contains a URL that has a canonical pointing elsewhere, you're submitting a non-canonical URL - Google will likely ignore or downgrade it. A quick audit: crawl your sitemap URLs with Screaming Frog, check each page's canonical tag, and verify that canonical matches the sitemap URL exactly including trailing slash, protocol, and subdomain. Any mismatch is a signal that needs to be resolved.

Check your canonical configuration
Free sitemap analysis in 60 seconds
Analyze My Site Free

Related Guides

Is your sitemap hurting your Google rankings?
Check for free →