Canonical URL link

寵の児 提交于 2021-02-10 18:18:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!