2 # see cgi/htaccess for gitweb.cgi restrictions
7 # baidu spiders lie about their user agent but seem to
8 # come from the range 123.125.71.11 - 123.125.71.161 but
9 # that's all part of the same subnet allocation so we
10 # block that whole subnet from the expensive operations
12 # apparently many other spiders send the exact UA string:
13 # Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
14 # which does not actually correspond to any released version
15 # of IE so we block those exact UA strings as well
17 # anything with AhrefsBot/ in the agent is considered harmful
19 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
20 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
21 RewriteCond %{HTTP_USER_AGENT} AhrefsBot/ [NC,OR]
22 RewriteCond %{HTTP_USER_AGENT} (Slurp|Bot|Spider) [NC]
23 RewriteRule ^r/ - [NS,F,L]
25 # If you have mod_status enabled AND this host ends up being the default
26 # host (see `apache2ctl -S` output), then you will probably need to
27 # uncomment the next line in order to make `apache2ctl status` work
28 #RewriteCond %{REQUEST_URI} !=/server-status
29 RewriteCond %{REQUEST_FILENAME} !-f
30 RewriteRule .+ - [NS,R=404,L]