According to the documentation on http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html, the variable REQUEST_FILENAME is the full local filesystem path: "REQUEST_FILENAME The full local filesystem path to the file or script matching the request." This seems not to be the case. It seems the variable should be prefixed with DOCUMENT_ROOT to get the full path. Examples: This does not trigger the rule: RewriteCond %{REQUEST_FILENAME} -s But this does: RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s Please update the documentation or the implementation. I lost several hours over this and I guess I'm not the only one.
The value of REQUEST_FILENAME depends upon context. It contains the full physical path only, if the request has already been mapped to the file system (-> directory context). That's not the case if you're using mod_rewrite in per-server context – you're still on uri-level. The full physical path is simply unknown in this state of processing. To get the full physical path in server-context, you'll need an internal sub-request (%LA-U or %LA-F). Prefixing with document_root is not a solution, because this may not be the physical path at the end (think about aliases, mod_userdir etc.). May be the docs should state that more clearly, but not the quoted 1.3 ones.
*** This bug has been marked as a duplicate of bug 16402 ***