使用IIS Rewrite模块为PDF添加Canonical URL失败,求解决方案
IIS Rewrite模块为PDF添加Canonical URL无效问题
我尝试仅使用IIS Rewrite模块为PDF文件添加Canonical URL,但配置后无法生效。预期要生成的响应头如下:
Link: <http://www.example.com/downloads/whitepaper.pdf>; rel="canonical"
当前使用的XML配置
<outboundRules rewriteBeforeCache="true"> <rule name="Canonical For PDF" preCondition="IsPDF"> <match serverVariable="RESPONSE_Link" pattern=".*" negate="false" /> <conditions> </conditions> <action type="Rewrite" value="<{HTTP_HOST}{REQUEST_URI}>; rel="canonical"" /> </rule> <preConditions> <preCondition name="IsPDF"> <add input="{REQUEST_FILENAME}" pattern="\.pdf.*" /> </preCondition> </preConditions> </outboundRules>
内容的提问来源于stack exchange,提问作者Mike Flynn
相关产品推荐
相关产品推荐

