On Tue, 30 Jun 2009, Eric Lease Morgan wrote:
> Can someone here help me with a tricky Apache mod_rewrite configuration?
> I want to write a script accessible via a URL with the following shape:
> Where script is my (Perl) script and arg1 is some... argument.
> How do I configure Apache so script gets executed and passes the environment
> variable PATH_INFO along? I suppose I need to use mod_rewrite somehow. No?
If 'script' is actually in your document root, and not hiding somewhere
else, you just need to declare that
is a CGI (or mod_perl, or fastCGI).
Normally, you'd declare an entire directory, but you can use AddType in
the httpd.conf to declare that the appropriate file extension should be
executed, and AddHandler to declare what should be used to run it. In
your example, you didn't show an extension, but I think it's a default
that the extension matching is handled. (eg, if you have 'file.txt' and
'file.html', it'll look at the HTTP Accept header to determine which one
is preferred, and serve the 'best' one.)
Your other option is to use ScriptAliasMatch, where you can tell it that
it's a script, and that it's actually located somewhere else.
For the SCRIPT_INFO part -- you don't have to do anything, other than make
sure that whatever you do with mod_rewrite or the like doesn't strip it