SEO5 min readUpdated May 2025
How to Fix a Missing Canonical Tag — Step-by-Step Guide
A missing canonical tag is one of the most common SEO issues. It takes one line of HTML to fix — and it protects your rankings from duplicate content dilution. Here's exactly how to add it in plain HTML, Next.js, and WordPress.
Check If Your Site Has Canonical Tags →#1
SEO issue found
Prevents
Duplication
1 line
Of HTML code
Next.js
Example included
WordPress
Example included
HTML
Example included
Basics
What Is a Canonical Tag
1
The HTML tag
A canonical tag is a <link> element placed in the <head> of your HTML: <link rel="canonical" href="https://example.com/your-page-url" />
2
Self-referencing canonicals
The simplest and most common use: the canonical URL points to the page itself. This tells Google 'this URL is the preferred version' — defending against URL parameter duplication.
3
Cross-page canonicals
Used when multiple pages have very similar content (e.g., printer-friendly versions, mobile-specific URLs, or syndicated content). The non-preferred page's canonical points to the preferred one.
4
Canonical vs noindex
A canonical tag tells Google 'index this version, not that one'. A noindex tag tells Google 'don't index this at all'. Use canonical for duplicate content; use noindex for pages you don't want indexed.
Why
Why It Matters for SEO
1
Duplicate content dilution
When Google finds the same content at multiple URLs, it splits ranking signals across all versions. A canonical consolidates those signals to a single URL, making it rank higher.
2
URL parameter problems
E-commerce and CMS sites create hundreds of duplicate URLs via sorting, filtering, tracking, and session parameters. ?sort=price, ?ref=email, ?page=1 — these can multiply pages rapidly without canonicals.
3
Pagination handling
Without canonicals, a paginated blog (/blog/page/2) can compete with the main /blog page for the same keywords. Use canonical rel='prev'/'next' or point paginated pages to the first page.
4
Syndicated content
If your content appears on Medium, LinkedIn, or partner sites, canonical tags ensure your original version gets the SEO credit — not the syndicated copy.
5
HTTPS/HTTP and www/non-www variants
Four versions of a URL can exist: http://example.com, http://www.example.com, https://example.com, https://www.example.com. Canonical tags (and 301 redirects) consolidate these to one preferred version.
Fix
How to Add It (3 Platforms)
1
Plain HTML
Add inside the <head> tag of every page: <link rel="canonical" href="https://yourdomain.com/your-page-slug" />. Replace the URL with the full canonical URL including https:// and no trailing parameters.
2
Next.js (App Router)
In your page's metadata export: export const metadata = { alternates: { canonical: 'https://yourdomain.com/your-page' } }. Next.js automatically renders this as a canonical link tag.
3
Next.js (Pages Router)
Import Head from 'next/head' and add: <Head><link rel="canonical" href="https://yourdomain.com/your-page" /></Head>. For dynamic pages, build the canonical URL from the router.
4
WordPress
Install the Yoast SEO or Rank Math plugin. Go to SEO > Search Appearance and enable canonical tags. Both plugins auto-generate self-referencing canonicals for every page and post. You can override per-page in the post editor.
5
Verify after adding
Check your page's source code (View Source or Developer Tools > Elements > <head>) to confirm the canonical tag is present with the correct URL. AuditAI's free scan will also verify this automatically.
Check your canonical tags automatically
AuditAI scans your page for missing or incorrect canonical tags in under 30 seconds — and generates the exact tag you need to add. Free, no signup required.
Check My Canonical Tags Free →Frequently Asked Questions
What is a canonical tag and why does it matter for SEO?+
A canonical tag (<link rel='canonical' href='https://...'>) tells Google which version of a page is the 'original' or 'preferred' one when multiple URLs serve the same or similar content. Without it, Google may split ranking signals across duplicate URLs — reducing the ranking power of each. For example, https://example.com/page and https://example.com/page?utm_source=twitter are different URLs but the same content.
Should every page have a canonical tag, even if there are no duplicates?+
Yes. Google recommends self-referencing canonical tags on every page — a canonical tag that points to the page itself. This prevents issues with URL parameters (tracking parameters, sorting options), HTTPS vs HTTP variants, and trailing slash vs no trailing slash. It's a defensive measure that costs nothing to implement.
What happens if I set the wrong canonical URL?+
If your canonical points to a non-existent URL or to the wrong page, Google may ignore the tag (if it detects the signal is wrong) or deindex your page (if the canonical is respected and points to a 404). Always verify your canonical URLs after setting them. AuditAI checks that canonical URLs are correctly formatted and accessible.