{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "Server snippets" } }
{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "Generate Nginx, Apache, Netlify, and Vercel rules from one policy." } }
资源索引 Header
选择资源规则,上线前生成适用于 Nginx、Apache、Netlify 和 Vercel 的 X-Robots-Tag 配置。
location ~* \.(pdf)$ {
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
}
location ~* \.(jpg|png|webp)$ {
add_header X-Robots-Tag "noindex, noimageindex" always;
}# X-Robots-Tag Header 方案
- 项目: 网站上线素材
- Bot 目标: all
- 规则: 2
- 严重: 0
- 警告: 0
- 就绪: 2
## Nginx
```nginx
location ~* \.(pdf)$ {
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
}
location ~* \.(jpg|png|webp)$ {
add_header X-Robots-Tag "noindex, noimageindex" always;
}
```
## Apache
```apache
# Requires mod_headers
<FilesMatch "\.(pdf)$">
Header set X-Robots-Tag "noindex, nofollow, noarchive"
</FilesMatch>
<FilesMatch "\.(jpg|png|webp)$">
Header set X-Robots-Tag "noindex, noimageindex"
</FilesMatch>
```
## Netlify
```text
/downloads/*.pdf
X-Robots-Tag: noindex, nofollow, noarchive
/assets/originals/*
X-Robots-Tag: noindex, noimageindex
```
## Vercel
```json
{
"headers": [
{
"source": "/downloads/(.*).pdf",
"headers": [
{
"key": "X-Robots-Tag",
"value": "noindex, nofollow, noarchive"
}
]
},
{
"source": "/assets/originals/(.*)",
"headers": [
{
"key": "X-Robots-Tag",
"value": "noindex, noimageindex"
}
]
}
]
}
```{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "搜尋意圖" } }
{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "为 PDF、图片、下载文件和其他素材生成 X-Robots-Tag header 规则,支持 noindex、nofollow、noarchive 和 noimageindex。" } }
{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "Generate Nginx, Apache, Netlify, and Vercel rules from one policy." } }
{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "Choose noindex, nofollow, noarchive, and noimageindex for different file groups." } }
{ "t": 0, "b": { "t": 2, "i": [ { "t": 3 } ], "s": "Avoid accidentally indexing private PDFs, originals, or temporary assets." } }