You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SetEnvIfNoCase对IPv6地址机器人封禁失效问题求助

解决.htaccess封禁机器人对IPv6地址失效的方案

你当前使用的Order/Allow/Deny属于Apache旧版mod_access_compat模块的指令,这类指令对IPv6地址的支持存在兼容性问题,才导致封禁规则对IPv6机器人不起作用。

直接替换成Apache 2.4及以上版本推荐的mod_authz_host指令即可,这套指令完美兼容IPv4和IPv6:

SetEnvIfNoCase User-Agent "sitechecker.pro" bad_bot
SetEnvIfNoCase User-Agent "seostar" bad_bot
SetEnvIfNoCase User-Agent "SiteCheckerBotCrawler" bad_bot
SetEnvIfNoCase User-Agent "scan.lol" bad_bot

<Limit GET POST HEAD DELETE>
    Require all granted
    Require not env=bad_bot
</Limit>

说明

  • Require all granted:允许所有合法请求访问
  • Require not env=bad_bot:拒绝触发了bad_bot环境变量的请求(也就是匹配到指定User-Agent的机器人)

如果你的Apache版本还停留在2.2(强烈建议升级),可以先确保mod_access_compat模块已启用,同时在配置中添加IPv6 On开启IPv6支持,再保留原指令尝试,但这种方法不如新版指令可靠。

内容的提问来源于stack exchange,提问作者Joukhar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 12:14:54