View Single Post

  #3 (permalink)  
Old 12-04-2006
HansH
 
Posts: n/a
Default Re: alias - rewrite - proxy, which feature fits this

<info2@eb7.de> schreef in bericht
news:1165191016.928456.125250@n67g2000cwd.googlegr oups.com...
> The incoming request should look like :
> http://myserver.de/action/returnfile.ext
> and what apache should perform is the following:
> http://myserver.de/cgi-bin/action.pl?returnfile.ext


> without sending a redirect back to the client,

Try these untested lines in your Apache's config
RewriteEngine On
Rewriterule ^/action/(.*) /cgi-bin/action.pl?$1 [L,PT]

I'ld prefer to name the new query param to easier allow more
to be added
Rewriterule ^/action/(.*) /cgi-bin/action.pl?f=$1 [L,PT,QSA]

Be aware the file names MUST NOT contain any of these
characters: ? = & ;

By handling files of any extention your script may have to do
quite some extra work like setting content-type for any type.
More common is to only divert to a script .html urls, or requests
for .jpg-s to be watermarked.

> It seems that a ScriptAlias is the thing I want but I cant't handle the
> querystring

Although it is common to have
ScriptAlias /cgi-bin/ /parent of your document root/cgi-bin/
I do not see how to use it to fullfill your demand.
It just assigns a folder to have ONLY executable [script] files
Perl files located here should start -but for the leading spaces-
#!<path to>/perl.exe

If you plan to host the same script on linux set the first line to the needs
of linux
and set or modify the ScriptInterpreterSource directive in your config
http://httpd.apache.org/docs/2.0/mod...erpretersource

> and the feature to append a querystring is only available
> for proxying.

In the above rewriterule 'QSA': Query String Append

HansH