Securealy
Check · SEO · low · passive

Self-referencing canonical

A canonical link points at the page itself.

Severity
low
Tier
Passive: runs on any URL
Category
SEO
Fix
Summary below; full runbook in the Fix Kit, Module 02: Be found
Id
canonical

What this means

Your home page has exactly one <link rel="canonical"> tag and its href is the absolute URL of the page itself, on the host your site redirects to. Failing means the tag is missing, there is more than one, the href is relative, or it points at a different URL than the one we landed on, such as the www host or http.

How we test it

We fetch your home page, following at most 3 redirects, and note the final URL. We find every <link rel="canonical"> in the <head>, require exactly one, and compare its href to that final URL, ignoring a trailing slash. A single absolute https canonical equal to the final URL passes; anything else fails and we show the value we found.

Why it matters

A self-referencing canonical prevents duplicate-URL dilution. The same page is reachable with and without www, with and without a trailing slash, and with tracking parameters, and without a canonical each variant can be indexed as a separate page that splits the signals between them. A canonical that points at the wrong host is worse than none, because it tells the engine the page you want indexed lives somewhere else. The Fix Kit requires every URL in the sitemap to return 200 with a self-referencing canonical.

The fix

Set <link rel="canonical" href="https://YOUR_DOMAIN/"> in the <head> to the absolute URL of the page on the canonical host (Next.js: alternates.canonical in generateMetadata); if it points at www or http, the site URL constant is wrong and should be fixed in that one place. Then run node scripts/seo-audit.mjs https://YOUR_DOMAIN/sitemap.xml, which fails any page whose canonical is missing, relative, or differs from its URL. The full runbook is in the Fix Kit, Module 02.

Prompt for your AI

Paste this into the coding agent that built the app. It reproduces the finding and stops before changing anything; the fix steps are in the kit.

Do not change anything yet. This is a verification pass only.
Run: curl -sL --max-redirs 3 -o /tmp/home.html -w '%{url_effective}\n' https://YOUR_DOMAIN/
Print the final URL that command returned.
Run: grep -oiE '<link[^>]*rel="canonical"[^>]*>' /tmp/home.html
Print how many canonical tags there are and the href of each.
Tell me whether the href is absolute https and equal to the final URL, ignoring a trailing slash.
Find where the canonical is set in the code and show me the line and any site URL constant it uses.
List what it would take to make the canonical self-referencing, without editing anything.
Verify: exactly one canonical tag whose href matches the final URL; if not, report the mismatch and stop.

Next

Grade your own URL

Every grade lists this check with its evidence for your site. Two free grades a day.