httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terrence Brannon" <>
Subject [users@httpd] Mod_rewrite - how to do operations on entire URL including query string?
Date Thu, 17 Mar 2005 19:02:58 GMT
We are receiving URLS that we need to do two things to:

1) First unescape the entire URL including the query string
2) Change the question mark in front of the text STRING to its escaped
version - %3F

Then take the transformed URL and perform a GET back to the Apache
server that did the two transformations. 

The enclosed Perl program does what I described above. However, we do
not have mod_perl installed on these Apache servers so I have to use a
mod_rewrite solution.

---- snip -----

use strict;

use File::Slurp;
use URI::Escape;

my $url = File::Slurp::read_file STDIN ;

# unescape the entire URL with query string. this is very important
# as the %2F characters must be sent to recipient with them unescaped
$url = uri_unescape $url;

# escape the question mark just before "STRING"
$url =~ s!([?]STRING)!uri_escape($1)!e;

print $url

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message