How to Fix Canonical Tags Pointing to Non-200 URLs

A canonical tag tells search engines which URL is the main version of a page. If that URL redirects, returns a 404, or throws a server error, the signal is contradictory and usually gets ignored. By the end of this guide, every canonical on your site will point to a live, indexable URL that returns HTTP 200 directly.

By Updated ⏱ 30 minutes🎯 Beginner● High impactTechnical
Illustration: Canonical points to non-200 URL fix guide
TECHNICAL · FIX GUIDE Canonical points to non-200 URL IMPACTEFFORT TIME30 minutes LEVELBeginner

Why it matters

Google treats rel=canonical as a hint. When the hinted URL redirects or is broken, Google often discards it and picks its own canonical, which may be a parameter URL, an http version, or a duplicate. Ranking signals then split across duplicates, the wrong URL shows in search results and AI answer citations, and a canonical pointing to a 404 can make Google drop the page you actually wanted indexed.

Because the cause is usually one template or one site setting, a single fix often clears hundreds of pages.

✕Beforehttps://example.com/shoes/ has <linkrel="canonical"href="http://example.com/shoes">, and✓Afterhttps://example.com/shoes/ has <linkrel="canonical"href="https://example.com/shoes/">,

What you need

A list of flagged pages from your audit, or a crawl export from a tool such as Screaming Frog
Terminal access with curl, or any HTTP status checker
Access to your CMS SEO settings or the theme template that outputs <link rel="canonical">
Google Search Console access for the property

Step-by-step fix

1

List each flagged page and its canonical target

Export the affected URLs from the audit. For each page, record the exact href in its canonical tag. The audit only flags pages whose canonical differs from the page's own final URL, so you are looking at canonicals that point somewhere else.

Even a small difference counts, such as http vs https, www vs non-www, or a trailing slash.

text
curl -s https://example.com/shoes/ | grep -io '<link[^>]*rel="canonical"[^>]*>'
Pro tip: Some sites inject canonicals with JavaScript. If curl shows nothing, also check the rendered DOM in Chrome DevTools (Elements panel) and fix the server-side version first.
2

Check the status code of every canonical target

Put the canonical URLs in a file, one per line, and request each one without following redirects. Only a direct 200 passes. A 301 or 302 fails here, even if the redirect ends on a working page.

text
while read u; do printf "%s %s\n" "$(curl -s -o /dev/null -w '%{http_code}' "$u")" "$u"; done < canonicals.txt
Pro tip: Do not add -L to curl. You need the first response code, which is the one search engines see on the canonical URL.
3

Classify the failures by cause

Group the results, because each group has a different fix:

  • 301/302/307/308: the canonical uses an old, http, www/non-www or slash variant. Point it to the final destination URL.
  • 404/410: the target was deleted or moved. Point to the live replacement, or make the canonical self-referencing.
  • 401/403: the target is behind a login, geo-block or bot protection. Canonicals must point to publicly accessible URLs.
  • 5xx: the target is erroring. Fix the server issue, or point to a stable URL.
Pro tip: If nearly every flagged page fails the same way, such as http canonicals that 301 to https, the cause is one global setting or template, not individual pages.
4

Fix the site-wide canonical base URL

Most redirecting canonicals come from a wrong base URL in settings. com/. Then make sure the template builds canonicals from that base as absolute URLs.

Strip tracking parameters, but keep parameters that change content, such as pagination if you index paginated pages.

html
<link rel="canonical" href="https://example.com/shoes/">
Pro tip: Always use absolute URLs. Relative canonicals resolve unpredictably on staging hosts and alternate domains.
5

Correct per-page canonical overrides

Some pages have a canonical typed in by hand, often pointing to a product, post or category that was later deleted or renamed. Open each remaining flagged page in your CMS and update or clear the canonical override field. If there is no clear replacement, clear it so the page falls back to a self-referencing canonical.

Pro tip: When you delete or merge content, search your CMS database or crawl for canonicals pointing to the old URL before you publish the redirect.
6

Align redirects, sitemap and internal links

Every canonical target should also be the URL listed in your XML sitemap and used in internal links. Update the sitemap entries and menu links to the same 200 URLs. If you just added a redirect to consolidate URLs, update the canonicals at the same time, so none of them point at the redirected source.

7

Re-test and re-crawl

Purge any page cache or CDN cache, then run the curl status loop from step 2 again on the new canonical targets. Every line should show 200. Re-run the site audit to confirm that fewer than 1% of pages remain flagged.

Then use URL Inspection in Google Search Console on a few key pages to request reindexing.

text
while read u; do printf "%s %s\n" "$(curl -s -o /dev/null -w '%{http_code}' "$u")" "$u"; done < canonicals.txt | grep -v '^200'
Pro tip: An empty result from this command means every canonical target returns 200.

Platform-specific notes

WordPress

Set Settings > General > WordPress Address and Site Address to your exact https URL. Per-post overrides live in Yoast (post editor > Yoast SEO > Advanced > Canonical URL) or Rank Math (Rank Math panel > Advanced > Canonical URL). Check the permalink trailing-slash style in Settings > Permalinks, because a mismatch triggers 301s.

Shopify

Themes output {{ canonical_url }} in theme.liquid. It follows the primary domain set in Settings > Domains. If an old domain is still primary, or the theme hardcodes a URL, canonicals will redirect. Search your theme code for hardcoded rel="canonical" tags in sections or apps.

Next.js

Set metadataBase in the root layout (for example, new URL('https://example.com')) and alternates.canonical in each page's metadata or generateMetadata. Make the trailingSlash setting in next.config.js match the canonical paths, or every canonical will 308.

Webflow

Set Site settings > SEO > Global canonical tag URL to https://example.com with no trailing slash, matching your published default domain. Per-page canonical overrides are under Page settings > SEO settings. CMS template pages build canonicals from the collection slug, so renamed slugs that redirect need re-publishing.

Cloudflare

Rules such as Always Use HTTPS, or a Redirect Rule forcing www, will 301 any canonical that uses the old variant. Fix the canonicals at the origin rather than removing the rule. Also confirm that Bot Fight Mode or WAF rules don't return 403 to crawlers on canonical URLs.

Check that it worked

✅ How to verify

  • Run the curl status loop on all canonical targets without -L and confirm every one returns 200.
  • Re-run the audit and confirm the 'Canonical points to non-200 URL' check passes, with fewer than 1% of pages flagged.
  • In Google Search Console, use URL Inspection on a fixed page and check that 'User-declared canonical' matches 'Google-selected canonical' after recrawl.
  • Spot-check the live HTML (View Source) on two or three templates to confirm the canonical uses https, the correct host and the correct trailing-slash style.

⚠️ Common mistakes

  • Testing canonical targets with redirects followed (curl -L or a browser), which hides the 301 that search engines actually see.
  • Fixing pages one by one when the real cause is a global setting, such as an http site URL or the wrong primary domain.
  • Pointing canonicals of deleted or merged pages to the homepage, which Google treats as a soft 404 and ignores.
  • Updating redirects after a URL change but leaving canonicals, sitemap entries and hreflang tags on the old URLs.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Is it bad if my canonical points to a URL that 301 redirects?

Yes. The page says 'index URL A', while URL A says 'go to URL B'. Google may still work it out, but it often ignores the hint and picks its own canonical. Point the canonical straight to the final 200 URL.

Should every page have a self-referencing canonical?

For pages that are the main version, yes. A self-referencing canonical with the exact https URL that returns 200 is the safest default. Only point elsewhere when the page is a true duplicate or variant of another live page.

Can a canonical point to a noindex page?

It shouldn't. A canonical target must return 200 and be indexable. Pointing to a noindex, blocked or login-protected URL sends conflicting signals, and Google will usually ignore the canonical.

How long does Google take to pick up corrected canonicals?

It happens on recrawl, typically within days for important pages and a few weeks for deeper ones. Requesting indexing in URL Inspection and resubmitting your sitemap can speed up the key URLs.