: Schemaless URLs in canonical tags Is it a problem to put a schemaless URL in a canonical tag? Example: page URL is http://example.com while canonical tag is <link rel="canonical" href="//example.com"
Is it a problem to put a schemaless URL in a canonical tag?
Example: page URL is example.com while canonical tag is <link rel="canonical" href="//example.com" />.
More posts by @Courtney195
1 Comments
Sorted by latest first Latest Oldest Best
It’s technically allowed:
RFC 6596 allows relative URLs:
Specify a relative IRI (see [RFC3986], Section 4.2).
RFC 3986 defines that a protocol-relative URL is some kind of relative reference:
A relative reference that begins with two slash characters is termed a network-path reference […]
It can become a problem if the document is accessible from more than one scheme/protocol. So if you have a HTTP and a HTTPS version (and you don’t redirect one to the other), you end up with two different canonical URLs, which defeats the purpose of using canonical.
Also note that you don’t necessarily have control over the protocols. For example, if someone downloads your document (that contains a protocol-relative canonical URL) and uses it locally (file: scheme), the canonical URL wouldn’t point to your HTTP/HTTPS URL.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.