[英]How do I set the canonical header to a HTTP response?
I know that I can add a tag to the html head 我知道我可以在html头中添加标签
<link rel="canonical" href="https://geoffkenyon.com/how-to-add-canonical-tag-to-http-headers">
But I want to add this information in a HTTP response header instead. 但我想将此信息添加到HTTP响应标头中。 What header key and value would the above tag translate to?
上面的标签将转换为什么标头键和值?
I plan to do this in nginx as: 我打算在Nginx中这样做:
location /old-link {
add_header key value;
}
This adds a header successfully. 这将成功添加标题。 I haven't yet validated that google and others understand it.
我尚未验证Google和其他人是否理解它。
location /docs-test/Otii_Tech_Spec.pdf {
add_header Link '< href=https://geoffkenyon.com/how-to-add-canonical-tag-to-http-headers >; rel=\"canonical\"';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.