From 306e6720e8e12dc375548f8c014586f89e424da4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 15 Sep 2015 07:15:42 -0700 Subject: [PATCH] apache.conf: trump optional leading /[bhw] with existing file Signed-off-by: Kyle J. McKay --- apache.conf.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apache.conf.in b/apache.conf.in index b656640..afbd135 100644 --- a/apache.conf.in +++ b/apache.conf.in @@ -42,6 +42,8 @@ RewriteEngine On # Make the leading /h optional for requests that name an existing .html template + RewriteCond @@webroot@@/$1 !-f + RewriteCond @@cgiroot@@/$1 !-f RewriteCond @@basedir@@/html/$1 -f RewriteRule \ ^/(?![bchrw]/)(.*\.html)$ \ @@ -54,6 +56,8 @@ /w/$1.git [L,R=301] # ...and also make the leading /w optional for those types of requests + RewriteCond @@webroot@@/$1 !-f + RewriteCond @@cgiroot@@/$1 !-f RewriteCond %{HTTP_USER_AGENT} !git/ [NC] RewriteCond @@reporoot@@/$1.git/HEAD -f RewriteRule \ @@ -62,6 +66,8 @@ # Make the leading /w optional if the rest names an existing repo # and it's not a request for a bundle or bundle listing + RewriteCond @@webroot@@/$1$2 !-f + RewriteCond @@cgiroot@@/$1$2 !-f RewriteCond %{HTTP_USER_AGENT} !git/ [NC] RewriteCond @@reporoot@@/$1/HEAD -f # Might want to use [L,R] instead of [PT] maybe even [L,R=301] @@ -71,6 +77,8 @@ # Make the leading /b optional if the rest names an existing repo # and it's a request for a bundle listing + RewriteCond @@webroot@@/$1 !-f + RewriteCond @@cgiroot@@/$1 !-f RewriteCond %{HTTP_USER_AGENT} !git/ [NC] RewriteCond @@reporoot@@/$1/HEAD -f # Might want to use [L,R] instead of [PT] maybe even [L,R=301] @@ -92,8 +100,9 @@ # is not for an existing file, just send back an error # message without emitting anything into the error log. RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule .* - [R=404,L] + RewriteCond $1 !^$ + RewriteCond @@webroot@@/$1 !-f + RewriteRule ^/(.*)$ - [R=404,L] -- 2.11.4.GIT