httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Bond" <>
Subject [users@httpd] mod_rewrite and rewritemap
Date Fri, 01 Aug 2003 21:23:26 GMT
I am running apache 2.0.47 with rewrite+proxy module. After some struggle I 
managed to get it working. This whole solution is complex but interesting.
I am  still having few problems with rewritemap and rewriterules.

Redhat Linux
Apache 2.0.47
mod_rewrite, mod_proxy

Following are my rewrite rules:

RewriteMap    lb      prg:/usr/local/apache/current/conf/
RewriteRule   ^/(.*)  ${lb:$1\&%{query_string}}           [P,NC]
Proxypassreverse  /  ${lb:$1}

The above rules executes a perl script and pass the complete URL including 
querystring to the perl program on STDIN. Perl program grabs the STDIN value 
and transform it to a new URL with querystring . The perl program then pass 
the new URL to apache rule using STDOUT. The apache has been configured to 
accept the URL:
Client must always  see the external URL:
This setup works but I have few issues with it.

Following is my script

$| = 1;

# get query string
# loop reading from stdin
if ( $? == 0 ) {
while ( <STDIN> ) {

$URL1 = $_;

#code to process this URL

#Make a new URL
$URL2 = 

  print "$URL2$_";


Issue with the above rewrite rules and perl program:

1: perl program returns the value of $URL2 + $URL1. If I make the code from

print "$URL$_";
print $URL2;

The apache server just hangs and does not return anythng at all.

2: I have modified my application on server  to accept and 
process the URL sent by the above perl script

Now the problem is the apache rewrite rules does not work properly and 
cannot rewrite the URL properly. The client browser tries to contact the 
internal URL and it fails.

Can anyone please help me?


It's fast, it's easy and it's free. Get MSN Messenger today!

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