http://qs1969.pair.com?node_id=291468


in reply to Re: Perl script to handle requests to a http://.../path/*
in thread Perl script to handle requests to a http://.../path/*

I've been playing around with mod_rewrite and it seems to be able to achieve what i'm after. That is, if i could get it working properly... :)

At the risk of being flamed for pushing this thread further off-topic, could someone help me out with this?

What i actually want to achieve is to redirect all accesses, using mod_rewrite, to a perl script, so: http://www.domain.com/foo/bar gets sent transparently to: /cgi-bin/myscript.pl?foo/bar

What i have at the moment is a .htaccess (no root, remember) that contains:

RewriteRule ^(.*)$ /cgi-bin/myscript.pl?$1 [L]
However, this gets caught in a loop, despite the [L], giving a 500 with:
mod_rewrite: maximum number of internal redirects reached. Assuming co +nfiguration error. Use 'RewriteOptions MaxRedirects' to increase the +limit if neccessary.
It was my understanding (from RTFMing!) that [L] is meant to avoid this?!? Where have i gone wrong?

Update: found a solution, chain a neg regex in front

RewriteRule !^/cgi-bin - [C] RewriteRule ^(.*)$ /cgi-bin/myscript.pl?$1 [L]

- ><iper

my JAPH: print"Just another Perl hacker\n"; # ^ look, no space! pretty tricky huh?