The canonical tag contains href="article/", and a <base> with the address of another section appears above it. The string has not changed, but the browser has resolved it to a different full URL. Compare the value in the source with the resulting address to understand why.
How the browser resolves a relative address
MDN describes resolving relative links against the base URL, including root-relative links. Official documentation.
The strings article/, /article/, and https://example.com/article/ use different rules to construct an address. The first uses the base URL's current directory, the second uses its root, and the third specifies a full address. If the document contains a base tag for another domain, the first two strings may start pointing there. Canonical is often generated by a separate plugin that is unaware of the base setting in the theme. As a result, the source still contains article/, while the full address points to another section or an unrelated domain.
What different href values resolve to
| href value | Base set to | Resulting address | What this means |
|---|---|---|---|
| href="article/" | Base /docs/ | Resolves to /docs/article/ | Check document.baseURI |
| href="/article/" | Base on another host | Root of the other host | The slash does not fix the domain |
| Absolute HTTPS URL | Any base | Explicitly specified address | Preferred option |
| Script changes base | HTML differs before and after the script | Check again after loading | Find the generator |
Compare three values in the console
For the link you found, compare getAttribute("href") with its href property. The first returns the value as written; the second shows the element's resolved address in the browser. Also save document.baseURI. If these values do not match expectations, find the base tag in the document's head and determine where it comes from. Check all canonical elements: selecting only the first can hide duplicate output. This test does not prove that a search engine has already selected a different URL; it confirms a specific ambiguity or incorrect resolution in the current document.
({ база: document.baseURI, canonical: [...document.querySelectorAll('link[rel="canonical"]')].map(el => ({ записано: el.getAttribute('href'), вычислено: el.href })) });If записано contains article/, while вычислено shows an unrelated domain, check <base href="..."> in the head. Fix the canonical generator so that it outputs the full HTTPS URL of the intended page. The command only reads the page and does not change the site's settings.
Output a full URL in canonical
Output the full URL of the live site in canonical, for example https://example.com/docs/article/. Set the domain in the site settings. If it comes from the Host header—the domain name in the request—the developer must restrict it to allowed domains so that an unrelated request cannot insert a different host. Ask the developer to make sure the test-site build has not embedded its domain in the live version. If base is needed for other resources, leave it in place and fix only the canonical generator. If base is found to be incorrect, list the relative resources, menu links, and form submission addresses (action) that need to be checked after its removal. Removing base also changes ordinary links, so checking canonical alone is not enough.
Check the URL with and without a trailing slash
If there is no explicit base, the document's address becomes the base. For https://example.com/docs and https://example.com/docs/, the relative article/ may resolve differently because the first address looks like a file and the second like a directory. First find out whether the server redirects one version to the other, then resolve the address against the actual final URL. Check both forms by opening them directly, especially if an intermediary server in front of the application changes the path. If the generator outputs an absolute canonical, this difference no longer affects its href, but it can still affect ordinary relative links. The next time routes change, open both forms again: /docs and /docs/. This quickly shows whether the relative URL error has returned.
Open a nested page after the fix
The canonical's href value and the full address in the browser should match the intended full URL. If you changed base, also open a relative menu link and an image; check the form submission address (action) in the HTML without submitting the form.
Also read: HTML validation: why check the code and how to fix errors and Conflicts between canonical, sitemap, hreflang, and redirects. Site checks are available on the reChecker technical audit page.