Apache 2 rewrite and proxy - url encoding query string
am 06.12.2007 21:18:34 von Jim HayterHi,
I'm experimenting with migrating from Apache 1.3 with many rewrite rules
and mod_perl to a mix of Apache 2.2 and Apache 1.3. I'm trying to use
Apache 2 as the front end with mod_rewrite and proxying the perl scripts
back to Apache 1 with mod_perl.
Apache 2.2 gives me more bandwidth control options so I want it as the
front end. Since the existing code all uses mod_perl with Apache 1.3, I
want to keep that for the back end.
My current issue is rewrite rules that move parts of the
REQUEST_FILENAME to the QUERY_STRING in the resultant URL, e.g.:
RewriteRule ^/query/([^_/]*)_?([^/]*)/?
/cgi-bin/script.pl?foo=$1&bar=$2 [QSA]
If the original request had characters that were URL encoded, they are
no longer encoded when handled by the RewriteRule. One method I know is
to pass the item ($1 or $2) to a RewriteMap'd script to return the url
encoded value. I worry that this is not efficient if I have to do so
for a large number of items.
Is there a better way to re-url encode the values when rewriting them to
the query string?
Thanks,
Jim