Re: serve items in "lib" or "PATH" fashion
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Perrin Harkins wrote: > On Tue, Jan 17, 2012 at 4:31 AM, André Warnier <[email protected]> wrote: >> E.g. I would be happy if I could write this in the Apache configuration : >> >> ScriptAlias /cgi-bin/ /var/www/site1/cgi-bin/;/var/www/global/cgi-bin/ >> >> and have Apache look first in the local one, then in the global one each >> time it is looking for a given script. And similarly for other documents >> like javascript libraries. > > Use mod_rewrite. See "Search pages in more than one directory": > http://httpd.apache.org/docs/2.0/misc/rewriteguide.html > Thanks, Perrin. I didn't know mod_rewrite could to do that. 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. Instead, should the example rule not be something like : RewriteRule ^.*$ /dir1/%{REQUEST_FILENAME} [L] ?