Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
moyaya
V2EX  ›  Linux

求大神指导!求教 Apache RewriteCond 规则正确写法?

  •  
  •   moyaya · May 12, 2024 · 1581 views
    This topic created in 754 days ago, the information mentioned may be changed or developed.
    最近 2 天,有很多垃圾采集站通过不同 IP 大量爬内容,后台设置的自动封禁 IP 策略不起作用,因此,想尝试通过 Apache2 RewriteCond 规则,禁止带有相关关键字的访问请求。


    目前写的规则如下,但观察下来,好像不起作用,所以请教一下大神,应该如何写?

    RewriteEngine On
    RewriteCond %{QUERY_STRING} 8233066\.com [NC,OR]
    RewriteCond %{QUERY_STRING} hkotc\.cc [NC,OR]
    RewriteCond %{QUERY_STRING} seo999888 [NC]
    RewriteRule ^ - [F]
    1 replies    2024-05-12 21:31:12 +08:00
    hefish
        1
    hefish  
       May 12, 2024
    你这 RewriteRule ^ - [F] 不大对吧,是不是要 RewriteRule .* - [F}
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:08 · PVG 17:08 · LAX 02:08 · JFK 05:08
    ♥ Do have faith in what you're doing.