Afficher un message
Vieux 08/02/2005, 11h43   #1
marc.poulhi-NO-es-SPAM@epfl.ch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Strange apache's mod_rewrite and file/directory existance test behavior

Hi,

I have some RewriteCond to check if a given file within a directory
exists. Both file and directory can be inexistant.

The rule is:

RewriteCond %{DOCUMENT_ROOT}/rfiles/${NodesToCluster:%{REMOTE_HOST}|default}/$1 -f
RewriteRule ^/files/(.*)$ /rfiles/${NodesToClusters:%{REMOTE_HOST}|default}/$1 [L]

Where the NodesToCluster is a map.

If I have something like:

/rfiles/mycluster/myfile

and someone mapping to mycluster is requesting /files/myfile, all is ok.
If I remove the 'myfile' from the directory, I get this error:
File does not exist: /var/www/html/rfiles/mycluster/myfile

I think that the RewriteCond should return false in that case... But the
strange thing is that if I use something like:

RewriteCond %{DOCUMENT_ROOT}/rfiles/${NodesToCluster:%{REMOTE_HOST}|default}/foo/$1 -f
^^^^^
It will not complain about foo not being there, it will return false and
work as expected.

I am reading and reading the docs, but I really don't understand how
these tests are working.

Marc
  Réponse avec citation
 
Page generated in 0,05230 seconds with 9 queries