From ef9f0f5262627f17216ede907511647c19afbff7 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 29 Oct 2009 17:49:25 +0100 Subject: [PATCH] htaccess: Add what we currently use, spider-protection --- htaccess | 14 ++++++++++++++ install.sh | 1 + 2 files changed, 15 insertions(+) create mode 100644 htaccess diff --git a/htaccess b/htaccess new file mode 100644 index 0000000..c9f8235 --- /dev/null +++ b/htaccess @@ -0,0 +1,14 @@ +RewriteEngine On + +RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider) +RewriteRule ^r/ - [F,L] + +RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider) +RewriteCond %{QUERY_STRING} a=(blame|blob_plain|blobdiff|diff|snapshot|commitdiff|history|shortlog) [OR] +RewriteCond %{QUERY_STRING} a=log.*f= +RewriteRule .* - [F,L] + +RewriteBase / +RewriteCond %{HTTP_USER_AGENT} ([sS]lurp|[bB]ot|[sS]pider) +RewriteCond %{QUERY_STRING} (.*h=.*;)hb=[^;]*(.*) +RewriteRule (.*) $1?%1%2 [R=303,NE,L] diff --git a/install.sh b/install.sh index ac08513..ce63752 100755 --- a/install.sh +++ b/install.sh @@ -100,4 +100,5 @@ ln -fs "$cfg_basedir"/Girocco "$cfg_cgiroot" cp gitweb/indextext.html "$cfg_webroot" mv "$cfg_basedir"/html/*.css "$cfg_basedir"/html/*.js "$cfg_webroot" cp mootools.js "$cfg_webroot" +cp htaccess "$cfg_webroot/.htaccess" cat gitweb/gitweb.css >>"$cfg_webroot"/gitweb.css -- 2.11.4.GIT