Relative Canonical URL Example
The hurricane carried my cucumber orchard off, and I can tell you only that it is near here.
The short answer
- What it is
- A relative canonical is a canonical tag whose href has no scheme or host, such as /shoes/. The reader has to work out the full URL from the page's own address.
- Why it matters
- A relative value is easy to resolve in the wrong way. It can carry a staging host or an http address straight into the signal you send.
- How a crawler should report it
- A crawler should show a relative canonical warning with the raw href and the resolved URL. It should keep the raw value, since the resolved URL can hide the fault.
- Live examples
/lab/relative-canonical/(positive)/lab/relative-canonical/near-miss/(near miss)

Why a canonical href should spell out the full address
A relative canonical uses a short path in place of a full URL, as in <link rel="canonical" href="/shoes/">. RFC 6596 allows this form, so it is not invalid. Still, Google recommends absolute URLs. Relative tags come from templates that print a path variable, from CMS settings that hold no domain, and from code moved between staging and live sites without a change.
The reader builds the full URL from the address of the page. A value like /shoes/ takes the scheme and host of the current URL. So if the page is reachable at http, or at a staging host, the tag points there too. The value shoes/, with no first slash, is worse. It is resolved against the current path, so it can make a URL that never existed. A <base> tag can change the result again.
Browsers do not use the tag at all. Search engines do resolve it and can often reach the right URL. The risk is in the edge cases. If a copy of your site is served on another host, every relative tag there will point to that host. The copy then claims to be the main version. An absolute tag would have named your real URL, and helped search engines sort it out.
To detect it, read the raw value of the first canonical tag before you resolve it. Flag any value that does not start with a scheme. A value that starts with // has no scheme and should also be reviewed. To fix it, build the tag from one configured site URL, and use the full form, with https and your preferred host. Then view the page source on each host to check that the tag is the same.