{ "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." } }