问题原文
原帖链接 · André Craveiro · CC BY-SA 3.0
I'm trying to add the rel=canonical tag to only one page. In order to add the tag, I need to add it to the part, in the mod_header.php file. This will add the same rel canonical tag to all the pages of my website.
How can I add rel canonical to only one page. I don't want to do a 301 redirect, I want to add a rel=canonical tag.
Can this be done with some .htaccess code?
已采纳解答
原帖链接 · Evgeniy · CC BY-SA 3.0
Add to htaccess:
<Files "file.html">
Header add Link "<http://www.example.com>;rel=\"canonical\""
</Files>
For further info read: https://moz.com/blog/how-to-advanced-relcanonical-http-headers
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
