2 # see htaccess for general 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 %{HTTP_USER_AGENT} AhrefsBot/ [NC]
20 RewriteRule .* - [NS,F,L]
22 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
23 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
24 RewriteCond %{HTTP_USER_AGENT} (Slurp|Bot|Spider|Riddler|ltx71|Crawl) [NC]
25 RewriteCond %{QUERY_STRING} a=(blame|blame_data|blame_incremental|blob_plain|blobdiff|diff|snapshot|commitdiff|history|refs|shortlog) [OR]
26 RewriteCond %{QUERY_STRING} a=log.*f=
27 RewriteRule .* - [NS,F,L]
29 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
30 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
31 RewriteCond %{HTTP_USER_AGENT} (Slurp|Bot|Spider|Riddler|ltx71|Crawl) [NC]
32 RewriteRule /(blame|blame_data|blame_incremental|blob_plain|blobdiff|bundles|diff|snapshot|commitdiff|history|refs|shortlog)(/|$) - [NS,F,L]
34 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
35 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
36 RewriteCond %{HTTP_USER_AGENT} (Slurp|Bot|Spider|Riddler|ltx71|Crawl) [NC]
37 RewriteCond %{QUERY_STRING} (.*h=.*;)hb=[^;]*(.*)
38 RewriteRule (.*) $1?%1%2 [NS,R=303,NE,L]