Re: Problems with mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You have to capture something to use $1 as your key

On Apr 2, 2011 4:19 PM, "Greg Allen" <gallen@xxxxxxxxxxx> 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-unsubscribe@xxxxxxxxxxxxxxxx
> " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux