Skip to main content
SlapMyWeb

SEO fix

How to Add a Canonical Tag

Name the preferred URL so duplicate addresses do not split your ranking signals.

Difficulty
Easy
Impact
High
Time
30 min

Before

<!-- /page, /page/, /page?utm_source=x all indexable as separate URLs -->

After

<link rel="canonical" href="https://example.com/page">
Before and after code for: How to Add a Canonical Tag

A missing canonical tag leaves search engines to choose which of several addresses for the same content to index. Any page reachable with tracking parameters, with and without a trailing slash, or on both www and apex has duplicates: and without a canonical, ranking signals split across them instead of accumulating on one.

Why it matters

Around 40% of audited sites have no canonical tag. It is the cheapest fix available for a problem that quietly divides a page's authority between addresses nobody meant to create.

How to fix it

  1. Decide the preferred URL

    Pick one form and be consistent: https, one host, one trailing-slash convention, no tracking parameters.
  2. Add the tag to every page

    Each page should declare its own canonical: pointing at itself where it is the preferred version. Self-referential canonicals are correct, not redundant.
  3. Use absolute URLs

    A relative canonical is legal but easy to get wrong. Absolute removes the ambiguity.
  4. Keep it consistent with everything else

    The canonical, the internal links, the sitemap entry and any redirects must all agree. Contradictions are treated as a weak hint and ignored.

The code

Beforehtml
<!-- /page, /page/, /page?utm_source=x all indexable as separate URLs -->
Afterhtml
<link rel="canonical" href="https://example.com/page">

On your platform

WordPress

SEO plugins add self-referential canonicals automatically. The usual problem is a manual override left on a page after a migration.

Next.js

Set alternates.canonical per page in the metadata export; it is not generated for you.

Sources

Fixed that one.
Now find the rest.

A free audit ranks every issue on your site by the score points it costs, and links each one straight to its guide.

Run a free audit
Free foreverNo signupLive scan progress