40.77.67.2 - - [08/Apr/2026:12:53:37 +0800] "GET /?s=%E4%B8%AD%E5%9B%BD%E6%B3%B0%E5%9B%BD%E8%B6%B3%E7%90%83%E7%9B%AE%E5%89%8D%E6%AF%94%E5%88%86 HTTP/2.0" 200 521 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36"
一分钟多次被爬取这个搜索页面,这种页面权重低、重复度高、还巨耗服务器,搜索引擎本来就不该爬。
解决方法:
robots.txt更新限制
# 仅允许百度、字节、Google、Bing
# 禁止爬站内搜索 /?s= (重点!)
# 禁止后台、接口、动态php、带参页面
User-agent: Baiduspider
Allow: /
Disallow: /wp-json/
Disallow: /*.php
Disallow: /?s=
Disallow: /*?s=
Disallow: /wp-admin/
Crawl-Delay: 3
User-agent: Bytespider
Allow: /
Disallow: /wp-json/
Disallow: /*.php
Disallow: /?s=
Disallow: /*?s=
Disallow: /wp-admin/
Crawl-Delay: 3
User-agent: Googlebot
Allow: /
Disallow: /wp-json/
Disallow: /*.php
Disallow: /?s=
Disallow: /*?s=
Disallow: /wp-admin/
Crawl-Delay: 3
User-agent: Bingbot
Allow: /
Disallow: /wp-json/
Disallow: /*.php
Disallow: /?s=
Disallow: /*?s=
Disallow: /wp-admin/
Crawl-Delay: 5
# 其他所有爬虫全部禁止
User-agent: *
Disallow: /
然后搜索平台提交更新。
然后再平台页限制访问:
第一步:把这段代码 放到 server { 里面
粘贴位置:listen 443 下面,root 上面
set $block_me 0;
if ($http_user_agent !~* "iPhone|iPad|iPod|iOS|A51stapp") { set $block_me 1; }
if ($request_uri ~* "\?s=") { set $block_me "${block_me}_yes"; }
if ($block_me = "1_yes") { return 403; }
完整正确位置示范:
server
{
listen 443 ssl http2;
server_name www.你的网址.com;
index index.php index.html;
root /www/wwwroot/xxx;
###########################################################
# 就粘贴在这里!!! 就粘贴在这里!!! 就粘贴在这里!!!
###########################################################
set $block_me 0;
if ($http_user_agent !~* "iPhone|iPad|iPod|iOS|tengxun") { set $block_me 1; }
if ($request_uri ~* "\?s=") { set $block_me "${block_me}_yes"; }
if ($block_me = "1_yes") { return 403; }
location / {
try_files $uri $uri/ /index.php?$args;
}
}
效果 100% 达到你要的
- 苹果手机 → 正常搜索
- ua含tengxun→ 正常搜索
- Bing 爬虫 / 百度 / 谷歌 / 安卓 / 电脑 → 访问
/?s=→ 403 直接拦截 - 你日志里的
200马上变成403
















