SEO wise, is it okay to use an protocol free URL like this?
<link rel="canonical" href="//example.com" />
I redirect all users to HTTPS anyway.
With protocol free I mean not using either http:// or https:// but // instead.
SEO wise, is it okay to use an protocol free URL like this?
<link rel="canonical" href="//example.com" />
I redirect all users to HTTPS anyway.
With protocol free I mean not using either http:// or https:// but // instead.
4
Answers
I believe you can’t, according to this website.
Also, I’d recommend the
https
, because Google is using it as a ranking signal.If the spec co-written by Google employees (https://www.rfc-editor.org/rfc/rfc6596) is correct, then yes, any relative reference is ok.
Yes
href
attribute on a canonical link is like allhref
attribute on<link>
: it supports URIs. And URIs can be full URIs or relative URIs.Moreover The Canonical Link Relation spec confirms that.
Then: of course you can use a relative URL like a protocol free one.
But don’t
I will recommend anyway to always use full URLs : scheme, host, path…
Why ? Because canonical URL is made to prevent from wrong URL to be used by robots.
Then using a relative URL might let some wrong URLs used by bots contrary to a full URL which you can be certain it is the right one.
Yes you can – both the spec and Google will allow a uri as a canonical href.
This does present a risk that your page is reached via the wrong protocol – eg: http page is visited when you want https canonical url’s. In this case the relative canonical value is interpreted as an http url.
However, if you have your 301 redirects correctly set up to go from http to https, you will not have an issue, and it may actually be preferable in some cases to use a relative canonical url.
Case in point, switching from an http site to https will lose you all your Facebook likes accumulated on your http url’s. In this case you may want Facebook to still crawl your http site, whilst redirecting all other user agents to https.
Facebook will then reinstate your old http page likes on both your http and https pages, but not if your page’s canonical url points to an absolute https url. In this instance a protocol relative canonical url – //www.mysite.com – is very useful.