Why do you want mod_rewrite at all? Enabling that mod_mime directive will let mod_autoindex remap / to /index.html when it exists in the virtual filesystem. -- justin
On Mon, Aug 23, 2010 at 10:48 AM, C. Michael Pilato <cmpil...@collab.net> wrote: > Hrm. I'm not seeing the connection here. I'm looking for a way to pull off > a Rewrite condition based on the existence of a given URI. The docs imply > that this can be done with "RewriteCond SOME_URI -U", but appear to just be > wrong -- the existence of SOME_URI doesn't appear to tested at all, only > it's accessibility (from an authn/authz standpoint). > > > On 08/20/2010 12:51 PM, Justin Erenkrantz wrote: >> Based on what you describe, I think this is likely what you are looking for: >> >> http://httpd.apache.org/docs/2.0/mod/mod_mime.html#modmimeusepathinfo >> >> http://mail-archives.apache.org/mod_mbox/httpd-dev/200209.mbox/%3c20020904211343.ga16...@apache.org%3e >> http://mail-archives.apache.org/mod_mbox/httpd-dev/200306.mbox/%3c2147483647.1054772...@[10.0.1.37]%3e >> >> HTH. -- justin >> >> On Fri, Aug 20, 2010 at 1:27 AM, C. Michael Pilato <cmpil...@collab.net> >> wrote: >>> [Warning: This matter is far from highly pertinent. One tackles strange >>> non-problems when in an atypical environment, such as a hotel room in CA.] >>> >>> I had someone ask me about Subversion autoindex support. So, like, you >>> point a web browser at >>> http://svn.apache.org/repos/asf/subversion/site/publish/ and *pow* magically >>> you are now looking at the index.html inside that directory. >>> >>> Clearly, this could be done with an hour or two of mod_dav_svn hackery and >>> some new directives there. But I was trying to come up with an httpd.conf >>> workaround that did the trick. Here's what I tried. (On my system, all my >>> Subversion repositories live inside the /repos/ Location.) >>> >>> # If this is a GET request (but not a subrequest) aimed at my >>> # collection of Subversion repositories and with a trailing slash, and >>> # if there exists an index.html file inside that directory, then >>> # temporarily redirect the browser to the index.html file. >>> RewriteEngine on >>> RewriteCond %{IS_SUBREQ} false >>> RewriteCond %{REQUEST_METHOD} GET >>> RewriteCond %{REQUEST_URI} ^/repos/.*/$ >>> RewriteCond %{REQUEST_URI}index.html -U >>> RewriteRule /repos/(.*)/$ /repos/$1/index.html [L,R] >>> >>> The result was that for every directory in which an index.html was found, >>> that file was served (via a browser redirect). Yay! Unfortunately, the >>> redirect was transmitted for directories which had no index.html child, too. >>> Boo! >>> >>> Sadly, I found that despite the fact that the Apache docs say about that >>> "-U" test the following: >>> >>> '-U' (is existing URL, via subrequest) >>> Checks whether or not TestString is a valid URL, accessible via all >>> the server's currently-configured access controls for that path. This >>> uses an internal subrequest to do the check, so use it with care - it >>> can impact your server's performance! >>> >>> In reality "validity" in this context seems to have nothing to do with >>> "existence". I traced the subrequest that mod_rewrite made into Subversion, >>> and found that it never enters mod_dav to actually perform an existence get. >>> I guess I expected that the subrequest would GET all the way into >>> Subversion, where it would get the appropriate error code (HTTP_NOT_FOUND). >>> In retrospect, I think I knew that subrequests don't behavior like >>> full-fledged content-fetching requests. But the documentation quoted above >>> is pretty misleading, at any rate, IMO. >>> >>> -- >>> C. Michael Pilato <cmpil...@collab.net> >>> CollabNet <> www.collab.net <> Distributed Development On Demand >>> > > > -- > C. Michael Pilato <cmpil...@collab.net> > CollabNet <> www.collab.net <> Distributed Development On Demand >