Re: serve items in "lib" or "PATH" fashion

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be2GTJuGYKNOyZTTdDGqHg7qDeSFDMZtUbOQ-7BVOihV+A@mail.gmail.com>
On Tue, Jan 17, 2012 at 10:02 AM, André Warnier <[email protected]> wrote:
> But isn't there an error in the examples shown ?
>
> RewriteCond         /your/docroot/dir1/%{REQUEST_FILENAME}  -f
> RewriteRule  ^(.+)  /your/docroot/dir1/$1  [L]
>
> If the original URL is e.g. "/cgi-bin/myscript.pl", and I wanted to check
> the local directory "/cgi-local" first, then this would evaluate to
>
> RewriteCond         /my/docroot/cgi-local/myscript.pl  -f
> but the "^(.+)" of the second line would evaluate to "/cgi-bin/myscript.pl"
> which would give a final URL of :
> "/my/docroot/cgi-local/cgi-bin/myscript.pl"
> which is probably not what I want.

It's kind of out-of-scope for the mod_perl list, but I think
REQUEST_FILENAME is the whole path.  Check the docs.

Regardless of the details, you seem to grasp how to make it work using
a -f RewriteCond, so play around with it until you get what you want.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.