Forbid web spiders/bots to crawl 'blame' and other views in gitweb
authorDaniel Knittl-Frank <knittl89+git@googlemail.com>
Wed, 4 Apr 2012 07:10:36 +0000 (4 09:10 +0200)
committerDaniel Knittl-Frank <knittl89+git@googlemail.com>
Wed, 4 Apr 2012 07:14:52 +0000 (4 09:14 +0200)
Original-author: Petr Baudis <pasky@suse.cz>

htaccess

index c9f8235..b2e85cc 100644 (file)
--- a/htaccess
+++ b/htaccess
@@ -8,6 +8,9 @@ RewriteCond %{QUERY_STRING}     a=(blame|blob_plain|blobdiff|diff|snapshot|commitdif
 RewriteCond %{QUERY_STRING}    a=log.*f=
 RewriteRule .*                 -               [F,L]
 
+RewriteCond %{HTTP_USER_AGENT}  ([sS]lurp|[bB]ot|[sS]pider)
+RewriteRule /(blame|blob_plain|blobdiff|diff|snapshot|commitdiff|history|shortlog)/ - [F,L]
+
 RewriteBase /
 RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider)
 RewriteCond %{QUERY_STRING}    (.*h=.*;)hb=[^;]*(.*)