This is a discussion on alias - rewrite - proxy, which feature fits this within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi group, thanks in advantage for your help! I want my apache 2.2 on windows to perform the following: ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi group,
thanks in advantage for your help! I want my apache 2.2 on windows to perform the following: 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, because in case of a download the client then tries to save a "action.pl" instead of a "returnfile.ext" I dont think a proxy is the right thing to do because its on my own machine. It seems that a ScriptAlias is the thing I want but I cant't handle the querystring and the feature to append a querystring is only available for proxying. Any Idea? best regards hatti77 |
|
|||
|
info2@eb7.de wrote: > Hi group, > thanks in advantage for your help! > > I want my apache 2.2 on windows to perform the following: > 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, because in case of a > download the client then tries to save a "action.pl" instead of a > "returnfile.ext" > > I dont think a proxy is the right thing to do because its on my own > machine. > It seems that a ScriptAlias is the thing I want but I cant't handle the > querystring and the feature to append a querystring is only available > for proxying. > > Any Idea? > best regards > hatti77 RewriteEngine On RewriteRule /([a-z]+)/(.*) /cgi-bin/$1.pl?$2 [L] this will redirect all requests to anything of the form /lowercaseword/anythingafterthis.ext to /cgi-bin/lowercaseword.pl?anythingafterthis.ext just shove it in a directory block as per instructions on apache docs for rewrites, or (less good) in an .htaccess file |
|
|||
|
<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 |
|
|||
|
HansH schrieb: > Rewriterule ^/action/(.*) /cgi-bin/action.pl?$1 [L,PT] .... perfect!, Thanks! > > 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] to be honest, I'm using vbs, not perl and this can handle only one parm ;-) greetings, Hatti77 |