I'm using Apache 2.2x. Most of the content is generated via mod_perl. So, it's dynamic content that has no filesystem mapping. Perfect use of < Location >.
Apache config:
<Location /finance_module1>
SetHandler perl-script
PerlResponseHandler Finance::Module1
</Location>
<Location /finance/module2>
SetHandler perl-script
PerlResponseHandler Finance::Module2
</Location>
Module1 works, and is shown here to show that my setup otherwise works.
Module2 does not work. Apache says "File does not exist: /home/joe/www/htdocs/finance". The only difference between the module configurations is that Module2 location contains multiple slashes (what I'm calling a nested path).
About the "File does not exist" error: Of course it doesn't exist -- it's a Location, not a File or Directory. So why does this happen?
I would like to be able to use paths with multiple slashes because I've got a lot of mod_perl modules, and it would be nice to categorize for purposes of control. For one trivial instance, robots.txt could simply say:
Disallow: /finance/
The Apache docs specifically state that < Location > directives need not map to the filesystem, and are well-suited for dynamically generated content.
What am I doing wrong? Is there a workaround? (Besides the obvious "just don't do that").
Thanks.
Answering my own question, for the benefit of anyone else wondering the same thing.
Short answer, use LocationMatch.
In the example above, say the urls are /finance/module1 and /finance/module2. Having the "finance/" path allows all the finance handlers to be configured as a group, in situations where that's desirable.
For example:
<LocationMatch /finance/.*>
SetHandler perl-script
PerlAccessHandler foo
</LocationMatch>
<Location /finance/module1>
SetHandler perl-script
PerlResponseHandler Finance::Module1
</Location>
<Location /finance/module2>
SetHandler perl-script
PerlResponseHandler Finance::Module2
</Location>