Canonical URLs: Prevent Duplicate and Wrong-Domain Signals
A canonical link tells search engines which URL you prefer for a piece of content when several URLs could represent the same or very similar page. It is easy to implement and easy to implement incorrectly.
The basic tag
A page can declare a canonical URL with a link element in the document head. For a normal unique page, a self-referencing canonical is common: the canonical points to the clean public URL of the page itself.
Canonicals are signals, not access controls and not a replacement for redirects when a URL has permanently moved.
Why launch environments cause mistakes
Developers often generate canonical URLs from an environment variable or request hostname. If that value still points to a Vercel preview, staging subdomain, localhost or an old production domain, every new page can advertise the wrong preferred URL.
Before launch, inspect the rendered source on several routes, not just the homepage.
Parameters and duplicate variants
Tracking parameters, sorting options and alternate route forms can create multiple URLs for similar content. A canonical can help consolidate those variants when the page content is substantially the same. If the pages genuinely differ, forcing them all to one canonical can hide useful distinctions.
Decide based on content and user intent, not merely URL appearance.
Canonical and redirects should agree
If http://example.com/page redirects to https://example.com/page, the final HTTPS page should normally canonicalize to the HTTPS URL. Likewise, site navigation and the sitemap should use that same preferred version.
Conflicting signals increase ambiguity and make migrations harder to diagnose.
How to test
For each representative page, confirm exactly one canonical is present, its URL is absolute and valid, it uses the preferred HTTPS host, and it identifies the content you expect. Then compare it with redirects, internal links and sitemap entries. The strongest setup is consistent across all of these signals.
Automated checks can confirm whether a public signal exists and looks technically reasonable. They cannot replace human review of content, accessibility, security, business logic or legal requirements.
Check a website