in reply to Re^4: [mod_perl] path_info() problem
in thread [mod_perl] path_info() problem
If the user requests /some/place/somedir, where somedir is a directory, and you return back a real page for that, and within that real page you place the link "file1", because you're talking about /some/place/somedir/file1, the browser will instead fetch /some/place/file1, because that's relative to the URL as presented.
So the solution is that you never serve a page for a directory that doesn't end in a slash. If you are asked for /some/place/somedir, you send an external redirect to /some/place/somedir/, so that relative names like "file1" are in the right place.
Now, either you can send the external redirect, or do as I did the lazy way, and simply decline the request, because mod_dir knows how to do that.
So, if the mime type is DIR_MAGIC_TYPE, and the uri does not end in /, return DECLINED. That's the rule, and it's a simple rule. Do that at the top of your handler.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: [mod_perl] path_info() problem
by insaniac (Friar) on May 11, 2005 at 11:02 UTC |