Thanks!  That was it.  I knew it was something simple....

-- Greg

On 4/2/2011 5:01 PM, Eric Covener wrote:
You have to capture something to use $1 as your key
On Apr 2, 2011 4:19 PM, "Greg Allen"<gal...@mycalet.com>  wrote:
Hello,

I am having problems getting mod_rewrite to work for me. I have a
simple rewrite program
written in perl. I have configured rewrite in the httpd.conf file and
turned on logging. It looks
as though my map program is being called, but no value is being returned
from the program (as
you can see from the rewrite.log.

I've included all the relevant files - httpd.conf, rewrite.pl, and
rewrite.log.

Can anyone tell me what is wrong?

Thanks,

-- Greg

httpd.conf:

RewriteEngine on
RewriteLog /tmp/rewrite.log
RewriteLogLevel 9
RewriteMap mymap prg:/tmp/rewrite.pl
RewriteRule /foo/? ${mymap:$1}

/tmp/rewrite.pl:

#!/usr/bin/perl -i

# Disable buffered I/O which would lead to deadloops for the Apache
server.
$| = 1;

while (<STDIN>) {
s|^foo/|bar/|;
print $_;
}

/tmp/rewrite.log:

127.0.0.1 - - [02/Apr/2011:15:06:42 --0400]
[localhost/sid#9d50a38][rid#9faa2b8/initial] (2) init rewrite engine
with requested uri /foo/
127.0.0.1 - - [02/Apr/2011:15:06:42 --0400]
[localhost/sid#9d50a38][rid#9faa2b8/initial] (3) applying pattern
'/foo/?' to uri '/foo/'
127.0.0.1 - - [02/Apr/2011:15:06:42 --0400]
[localhost/sid#9d50a38][rid#9faa2b8/initial] (5) map lookup OK:
map=mymap key= ->  val=
127.0.0.1 - - [02/Apr/2011:15:06:42 --0400]
[localhost/sid#9d50a38][rid#9faa2b8/initial] (2) rewrite '/foo/' ->  ''
127.0.0.1 - - [02/Apr/2011:15:06:42 --0400]
[localhost/sid#9d50a38][rid#9faa2b8/initial] (2) local path result:


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See<URL:http://httpd.apache.org/userslist.html>  for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
" from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org


--
Greg Allen
Calet, LLC
gal...@mycalet.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
  "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to