Hi,

I have a script which takes some input variables in the QUERY_STRING, let's
say:

http://localhost/query.pl?archive=1&chapter=2&section=3&subsection=4

This is working fine from the user perspective. But, I found out that most
search engines just discard the querystring, so my site won't get indexed.
Besides of that, urls are quite ugly this way. So what I want to do is do
some mapping between canonical urls and actual scripts on my server, so from
the users perspective, there would be:

http://localhost/query/archive/chapter/section/subsection

To achieve this, I tried both

AliasMatch ^/query/  /path/to/query.pl  (and let query.pl do a
split(/\//,$ENV{REQUEST_URI}))

and

RewriteRule ^/query/(.*) /query.pl?$1    (and let query.pl do a
split(/\//,$ENV{QUERY_STRING}))

These both seemed to work fine, untill I was facing a ps with some 90MB
httpd processes laughing at me. After reviewing /localhost/perl-status it
got clear to me. mod_perl obviously compiles scripts in a namespace derived
from the original REQUEST_URI, so query.pl gets compiled for each and every
combination of arguments.

Does anybody has some pointers on how to get mod_perl to compile query.pl
only once? Maybe by specifying the package namespace manually from within
httpd.conf instead of letting mod_perl do the job based on REQUEST_URI?

Ime



Reply via email to