Canonical points to a redirect or a 404: a hint Google has to throw away
A canonical tag tells search engines "index that URL instead of this one", so the URL it names has to be a working, indexable page. When the target redirects, returns 404 or carries noindex, the hint contradicts itself and Google is likely to disregard it and choose a canonical on its own.
The page still loads and nothing looks wrong to visitors. The cost is that you have handed the decision about which URL represents this content back to Google, on the pages where you specifically tried to make it yourself.
What it looks like
Before
<!-- on https://example.com/guide-to-mugs/ -->
<link rel="canonical" href="https://example.com/mug-guide/">
$ curl -sI https://example.com/mug-guide/ | head -n 1
HTTP/2 301
After
<link rel="canonical" href="https://example.com/guide-to-mugs/">
$ curl -sI https://example.com/guide-to-mugs/ | head -n 1
HTTP/2 200
Test the target in two commands
Extract the canonical from the page, then request it:
curl -s https://example.com/guide-to-mugs/ | grep -io '<link[^>]*rel="canonical"[^>]*>'
curl -sI "https://example.com/mug-guide/" | grep -iE "^(HTTP|location|x-robots-tag)"
A healthy target answers 200 with no Location header and no X-Robots-Tag: noindex. Then view the target's source and confirm two more things: it has no noindex robots meta tag, and its own canonical points to itself. A canonical that leads to a page which canonicalises somewhere else is a chain, and chains are as unreliable for canonicals as they are for redirects.
For a whole site, a crawler that reports "canonicalised to non-200" is the efficient route. Without one, export the URLs from your sitemap and loop the two commands over them.
How valid canonicals go stale on WordPress
A custom canonical outlived a URL change. Someone typed a canonical by hand, then the target's slug changed or the page was deleted. The default canonical follows permalinks automatically; a manual override is a stored string that never updates. In Hydrogen SEO the override lives in the Canonical URL field of the SEO Settings sheet. Clear the field and save to return to the self-referencing default.
Protocol or host mismatch. A canonical to http://example.com/page/ on an HTTPS site, or to www when the site redirects to the bare domain. The target technically exists but answers with a 301.
Trailing slash mismatch. WordPress redirects /page to /page/ when the permalink structure ends in a slash. A hand-written canonical without the slash therefore points at a redirect.
The target was consolidated. Page B was canonicalised to page A; later A was merged into C and redirected. B's canonical now needs to name C.
Imported settings. Canonical overrides carried across from a previous SEO plugin or a previous domain. After any migration, search the stored values for the old host.
Pick the right repair
- The page is the original. Remove the override so the canonical is self-referencing. This is the correct state for almost every page; see canonical URLs for when a custom value is justified.
- Another page really is the original. Update the canonical to that page's final URL: the address that returns 200 after all redirects, in the exact protocol, host and slash form your site uses.
- The page should not exist separately. If it duplicates the target and has no reason to stay reachable, replace it with a 301 redirect. A redirect is a stronger and cleaner signal than a canonical. Hydrogen SEO's redirection manager creates one from wp-admin.
- The target is noindexed. Decide which page should be in search. Either remove
noindexfrom the target or stop canonicalising to it.
When the target has been deleted and there is nothing to replace it, the page being inspected is now the only copy and should canonicalise to itself.
What Google does in the meantime
With a broken hint, Google falls back on its other canonicalisation signals: redirects, internal links, sitemap entries and content similarity. Often it selects the page itself, which is harmless. Sometimes it follows the redirect and treats that destination as canonical, which may or may not be what you intended. You will see the outcome in URL Inspection, where Google-selected canonical differs from User-declared canonical, and in the Page indexing report under Duplicate, Google chose different canonical than user.
After the change
Purge the page cache so the new tag is served, then repeat the two curl commands: the canonical should resolve to a 200 in one request. Run a live test in URL Inspection and check that the user-declared canonical shows the new value. Our free SEO audit confirms that a canonical tag is present on a URL; it does not follow the tag to test the target, so keep the curl check for that.
Common questions
Does Google follow a canonical through a redirect?
It may work out the intended destination, but you should not depend on it. Google's guidance is to point canonicals at the final, indexable URL.
Is a canonical to a 404 dangerous?
It will not remove the page from the index by itself, because Google ignores hints that make no sense. It does mean your canonical preference is not being applied.
Should the canonical include the trailing slash?
It should match the form your server returns with a 200. On most WordPress sites that is the version with the trailing slash.
How do I find every custom canonical on my site?
They are stored per post by your SEO plugin. Export or search the stored values, and check each against its current status code after any migration or bulk URL change.