Canonicalize duplicate URLs

Duplicate URLs split signals across protocol, host, slash and parameter variants. Pick one canonical form, emit one absolute self-referencing canonical per page, and align internal links, sitemap entries, hreflang and og:url with it. Use redirects when the duplicate should not exist at all.

highIn codeimpact effort

Why this matters

One canonical URL per page, agreed on by every signal.

Get the full breakdown

The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.

Join the waitlist

Before you start

  • A crawl of the site to enumerate URL variants

How to apply it

  1. Choose the canonical URL policy

    Decide protocol, host, trailing slash and parameter handling once, then apply it to routing, canonicals and links. Lowercase paths and strip tracking parameters.

    Check: A redirect map exists for every variant that will not be canonical, such as http to https and apex to www.

  2. Emit one absolute self-referencing canonical

    Add a single link rel=canonical in the head of each indexable page, pointing at its own canonical URL. Remove plugin or component duplicates that emit a second value.

    Check: curl -s your production domain/page | grep -c 'rel="canonical"' returns exactly 1.

  3. Align every other signal

    Update sitemap loc values, internal links, og:url and hreflang entries to the same canonical URL. A canonical that contradicts the sitemap sends mixed signals.

    Check: For ten sampled pages, canonical, sitemap loc and og:url are identical strings.

Get the prompt for your agent

A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.

Join the waitlist

Source: seo-mcp playbook · curated entry · report an error

Framework notes

nextjs-app

Set `alternates.canonical` in the `metadata` export or in `generateMetadata`; keep it absolute and per route, never in the root layout only.

astro

Render `<link rel="canonical" href={new URL(Astro.url.pathname, Astro.site)}>` in the layout head so every page gets its own URL.

wordpress

Let Yoast or Rank Math output the canonical, and remove hardcoded canonical tags from the theme header to avoid duplicates.

Official references

Let your agent apply this + 161 more tips.

Pre-order — $19