in my opinion some examples from http://httpd.apache.org/docs/misc/rewriteguide.html are not correct.
In particular I'm talking about of some usages of %{REQUEST_FILENAME}.From the link I posted you can find:
***********example 1, start... Search pages in more than one directory
RewriteEngine on
# first try to find it in custom/...
# ...and if found stop and be happy:
RewriteCond /your/docroot/dir1/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /your/docroot/dir1/$1 [L]# second try to find it in pub/...
# ...and if found stop and be happy:
RewriteCond /your/docroot/dir2/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /your/docroot/dir2/$1 [L]# else go on for other Alias or ScriptAlias directives, # etc. RewriteRule ^(.+) - [PT] ***********...example 1, end
***********example 2, start... Redirect Failing URLs To Other Webserver
RewriteEngine on
RewriteCond /your/docroot/%{REQUEST_FILENAME} !-f
RewriteRule ^(.+) http://webserverB.dom/$1
***********...example 2, endIn these examples you will see the usage of
/your/docroot/%{REQUEST_FILENAME}
/your/docroot/dir1/%{REQUEST_FILENAME}
/your/docroot/dir2/%{REQUEST_FILENAME}
That's not correct. Suppose the DocumentRoot is /your/docroot
for a request as www.example.com/myfile.php
%{REQUEST_FILENAME} will be /your/docroot/myfile.phpfor a request as www.example.com/path/to/myfile.php
%{REQUEST_FILENAME} will be /your/docroot/path/to/myfile.phpUsing
RewriteCond /your/docroot/%{REQUEST_FILENAME} !-f
means like
RewriteCond /your/docroot//your/docroot/myfile.php !-f
or
RewriteCond /your/docroot//your/docroot/path/to/myfile.php !-fand that's not correct.
I can illustrate what I said using my log file. I used these rules:
RewriteEngine on
RewriteCond /usr/www/example.net/htdocs/%{REQUEST_FILENAME} !-f
RewriteRule ^(.+) http://example.com/$1my DocumentRoot was "/usr/www/example.net/htdocs"
I requested: www.example.net/plata.php
etc (3) [per-dir /usr/www/example.net/htdocs/] strip per-dir prefix: /usr/www/example.net/htdocs/plata.php -> plata.php
etc (3) [per-dir /usr/www/example.net/htdocs/] applying pattern '^(.+)' to uri 'plata.php'
etc (4) RewriteCond: input='/usr/www/example.net/htdocs//usr/www/example.net/htdocs/plata.php' pattern='!-f' => matched
etc (2) [per-dir /usr/www/example.net/htdocs/] rewrite plata.php -> http://example.com/plata.php
etc (2) [per-dir /usr/www/example.net/htdocs/] implicitly forcing redirect (rc=302) with http://example.com/plata.php
etc (1) [per-dir /usr/www/example.net/htdocs/] escaping http://example.com/plata.php for redirect
etc (1) [per-dir /usr/www/example.net/htdocs/] redirect to http://example.com/plata.php [REDIRECT/302]
check (4) -->> input='/usr/www/example.net/htdocs//usr/www/example.net/htdocs/plata.php'
So summing instead of
/your/docroot/%{REQUEST_FILENAME}
/your/docroot/dir1/%{REQUEST_FILENAME}
/your/docroot/dir2/%{REQUEST_FILENAME}
it was more correct to use
%{REQUEST_FILENAME}
for all the examples I showed.What do you think ?
Thank you, Mr Andrea Rossignoli
p.s. Hope this is the correct mailing list... :-)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
