From 4f9ac9cc119e51c85c3f4a6b581031780980cfe0 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 18 Jul 2013 10:55:22 -0700 Subject: [PATCH] htaccess: suppress 'File does not exist' error log messages Various bots, spiders, crawlers, etc. often make requests for files that do not exist. Various web clients also make requests for several "well-known" files that may or may not exist on the server. When any of the files are not found a 'File does not exist' message is spewed into the error log file. Since these messages are generally uninteresting and only serve to make it more difficult to see any real errors in the log (there are a LOT of not found errors), suppress them. Since this is a .htaccess file, the suppression can easily be disabled temporarily while diagnosing a problem that actually requires these error messages. Since the access log continues to record the 404 result, this will normally not be necessary. --- htaccess | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htaccess b/htaccess index b2e85cc..051b461 100644 --- a/htaccess +++ b/htaccess @@ -8,10 +8,13 @@ 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) +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=[^;]*(.*) RewriteRule (.*) $1?%1%2 [R=303,NE,L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule .* - [R=404,L] -- 2.11.4.GIT