Canonical tag in HTML and HTTP header

This means that the URL in question has a canonical element specified both in the HTML and in the HTTP header.

Why is this important?

It is considered best practice to only specify canonicals using a single method on any given URL. This is because using both methods makes the configuration more open to human error.

Imagine you implement a canonical on Page A which points to Page B as the canonical URL, using BOTH a tag in the <head> and in the HTTP header. Some time passes, and you introduce a new page, Page C, which will also become the new canonical for Page A. You change the canonical in the <head> but completely forget about the existence of the canonical in the HTTP header, and so do not change it.

The net result would be mismatched canonicals, which would cause search engines to ignore the canonical instruction entirely (which would then trigger the Hint: Mismatched canonical tag in HTML and HTTP header).

You can avoid such catastrophic futures by only using a single method for defining canonicals.

What does the Hint check?

This Hint will trigger for any internal URL which contains a canonical link element both in the HTML and in the HTTP header, even if the canonical URLs are the same.

Examples that trigger this Hint:

Consider the URL: https://example.com/page-a

The Hint would trigger for this URL if it had canonicals in both locations pointing to the same URL;

Canonical link in the <head> to a URL

<link rel="canonical" href="https://example.com/page-b" />

AND HTTP Header canonical link to the same URL

HTTP/... 200 OK

...
Link: <https://example.com/page-b>; rel="canonical"

The Hint would also trigger for this URL if it had canonicals in both locations pointing to different URLs;

Canonical link in the <head> to a URL

<link rel="canonical" href="https://example.com/page-b" />

AND HTTP Header canonical link to the different URL

HTTP/... 200 OK

...
Link: <https://example.com/page-c>; rel="canonical"

How do you resolve this issue?

Simply select one method of defining canonicals, and only use that method. You may need to seek developer input to determine which method is easier to manage for each specific website.

Ready to try Sitebulb?
Start your free 14 day trial now

Start Free Trial