Home → Technical SEO → Fix guides → <link rel=canonical> present

tech

How to fix: <link rel=canonical> present

Part of the Technical SEO pillar on the Site Integrity Index.

Why this matters

When the same content is reachable via multiple URLs (trailing slash, query parameters, www vs. apex), <link rel="canonical"> tells crawlers which is the real version and prevents duplicate-content dilution.

Background

A canonical link tag tells search engines which URL to index when the same content is reachable at multiple addresses (http vs https, www vs apex, query-string variants). Without it, ranking is split across duplicates and the wrong URL might win — losing the SEO benefit of every backlink.

References

Google Search Central · technical SEO baseline

How to fix

Code snippet for each stack we cover. Pick the one matching your server / framework.

nginx
Set the canonical at the application layer — nginx can rewrite URLs to a single canonical though.
apache
Same — Rewrite to a single canonical.
cloudflare
Cloudflare Workers / Transform Rules can normalise host (www → apex or vice versa).
wordpress
Yoast / RankMath / All-in-One SEO all add canonical tags automatically.
flask
<link rel="canonical" href="https://your-site.com/canonical-path"> in your base template.
express
Same — render the canonical in your HTML template.
rails
<%= tag.link rel: 'canonical', href: canonical_url %>

Verify it's working

View source. <link rel="canonical"> should be present in <head> and point to the preferred URL.

Want to know if your site has this issue?

Run a free audit — security, GDPR, technical SEO, AEO/GEO, and WCAG accessibility.

Audit my site →