How can I match against the URL-path from the RewriteCond in a .htaccess?
I'd like this because I'm trying make one subdirectory of my web server transparently proxy + cache requests to another server, and I'd like to write the .htaccess like this:
RewriteCond "%{ENV:CACHE_BASE}/%{URL_PATH}" -f RewriteRule (.*) "%{ENV:CACHE_BASE}/$1" [L] RewriteRule (.*) "download_and_cache.cgi?$1" So that requests for files which already exist in the cache will be sent from within Apache, and requests for files which aren't in the cache will be handled by the download_and_cache.cgi script (which will put them in the cache).
NB: I can't use %(REQUEST_URI}, because if the .htaccess lives at /foo/, a request for /foo/README.txt will result in a cache check for $CACHE_BASE/foo/README.txt, instead of $CACHE_BASE/README.txt as it should.