我想添加X-Robots-Tag noindex, nofollow到网站的所有 .PDF 文件的 HTTP 响应中,以避免这些文档被 Google 搜索引擎引用。
这是适用于 Heroku 上带有 Spring boot 2.1 的 Tomcat 8 服务器。过去,我尝试过 Apache Server,并且noindex运行nofollow良好。
<Files ~ "\.pdf$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
Run Code Online (Sandbox Code Playgroud)