3 # baidu spiders lie about their user agent but seem to
4 # come from the range 123.125.71.11 - 123.125.71.161 but
5 # that's all part of the same subnet allocation so we
6 # block that whole subnet from the expensive operations
8 # apparently many other spiders send the exact UA string:
9 # Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
10 # which does not actually correspond to any released version
11 # of IE so we block those exact UA strings as well
13 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
14 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
15 RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider)
16 RewriteRule ^r/ - [F,L]
18 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
19 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
20 RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider)
21 RewriteCond %{QUERY_STRING} a=(blame|blob_plain|blobdiff|diff|snapshot|commitdiff|history|shortlog) [OR]
22 RewriteCond %{QUERY_STRING} a=log.*f=
23 RewriteRule .* - [F,L]
25 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
26 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
27 RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider)
28 RewriteRule /(blame|blob_plain|blobdiff|diff|snapshot|commitdiff|history|shortlog)/ - [F,L]
31 RewriteCond %{REMOTE_ADDR} ^123\.125\.71\. [OR]
32 RewriteCond %{HTTP_USER_AGENT} "=Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" [OR]
33 RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider)
34 RewriteCond %{QUERY_STRING} (.*h=.*;)hb=[^;]*(.*)
35 RewriteRule (.*) $1?%1%2 [R=303,NE,L]
37 RewriteCond %{REQUEST_FILENAME} !-f
38 RewriteCond %{REQUEST_FILENAME} !-d
39 RewriteRule .* - [R=404,L]