Mismatched 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, where the canonical URLs differ.

Why is this important?

If search engines encounter conflicting canonical URLs, they will ignore the canonical instruction entirely. This could result in the indexing of pages which you do not wish to be indexed, such as duplicate content.

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, where the canonical URLs are not the same.

Note: if this Hint triggers, it will also trigger the Hint: Canonical tag in HTML and HTTP header.

Examples that trigger this Hint:

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

The Hint would trigger for this URL if it had both of the following;

Canonical link in the <head> to a URL:

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

AND HTTP Header canonical link to a different URL:

HTTP/... 200 OK

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

How do you resolve this issue?

The first task is to determine which is the correct canonical URL, and then ensure that this is the only one that is referenced.

Following on from this, it is considered bad practice to specify canonicals in two locations - even if the canonical URLs match - because it can lead to errors such as this one. As such it is recommended that you also seek to remove one of the canonical methods.

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