问题
I am using a canonical url link
<link rel="canonical" href="http://test123.com" />
to avoid duplicate content issues between http and https versions of a site. At the moment I have it set up that both the http and https versions have the canonical link in the head section.
Is this correct or should I only have the canonical link in the head section on the https version and nothing on the http version? Or does it matter either way?
(I want bots to index my http version and not my https version).
回答1:
In my opinion you can set your canonical url in http like so
<link rel="canonical" href="http://test123.com" />
for both http and https. Bots will be index your http canonical url. If you need https version of that page, you can make a redirect on the http page. If a user goes to http://test123.com
you can redirect user to https page according to your needs.
来源:https://stackoverflow.com/questions/10297188/canonical-url-link