You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by André Malo <nd...@perlig.de> on 2003/05/24 00:40:18 UTC

PR 20195: should we ignore RewriteRules ...

...in non-trailing-slash directories?

The following situation happens:

one calls <http://example.com/foo> where foo is a directory on the server
containing a htaccess file with rewrite rules. This htaccess will be
"executed" by calling the URL. As stated in PR 20195 the path won't be
stripped from r->filename and the rewriterules match on the actual system
path.
(the path is /system/path/to/foo/ (with trailing slash) and therefore can't
be stripped from /system/path/to/foo (without slash))

One could check that and strip it anyway but the behaviour is probably not
desired (path confusions). I'd suggest, let's ignore the rules in such a
case.
The attached patch does this. Opinion anyone?

nd
-- 
die (eval q-qq:Just Another Perl Hacker
:-)

# André Malo, <http://www.perlig.de/> #

directory requests without trailing slash (was: PR 20195: should we ignore RewriteRules ...)

Posted by André Malo <nd...@perlig.de>.
* Joshua Slive wrote:

> On Sat, 24 May 2003, André Malo wrote:
> 
>> ...in non-trailing-slash directories?
>>
>> The following situation happens:
>>
>> one calls <http://example.com/foo> where foo is a directory on the server
>> containing a htaccess file with rewrite rules. This htaccess will be
>> "executed" by calling the URL.
> 
> Perhaps a stupid question, but why is the .htaccess file being read at all
> in this circumstance?

Good question, it seems, at least for historical reasons... (1.3 does also).

> /foo is not a real resource in this circumstance.

If I understand it correctly, the directory walk treats it not different
from a directory with trailing slash. Both map to the directory /path/to/foo
(and read the .htaccess files in /path/to/foo). The mod_dir redirect is
actually a cosmetic URL change. If it's not present, a request to foo
without trailing slash would, for example, also trigger mod_autoindex (with
not-so-usable results, of course).

However, we may decide to drop reading .htaccess files and <Directory>
sections in that case entirely, since the request didn't really "enter" the
directory. But it's not backwards compatible at all and may have
side-effects (thinking of redirect-carefully).
And - someone could easily add a(nother) handler for directory requests to
make them valid resources.

I don't what to do. Any opinions about semantics here?

nd
-- 
"Die Untergeschosse der Sempergalerie bleiben währenddessen aus
 statistischen Gründen geflutet." -- Spiegel Online

Re: PR 20195: should we ignore RewriteRules ...

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 24 May 2003, André Malo wrote:

> ...in non-trailing-slash directories?
>
> The following situation happens:
>
> one calls <http://example.com/foo> where foo is a directory on the server
> containing a htaccess file with rewrite rules. This htaccess will be
> "executed" by calling the URL.

Perhaps a stupid question, but why is the .htaccess file being read at all
in this circumstance?  /foo is not a real resource in this circumstance.
We just happen to be polite and redirect to /foo/ to help people out.

Joshua.