You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "Fagyal, Csongor" <co...@conceptonline.hu> on 2003/10/13 14:17:06 UTC

Config question

Hi,

I would like to map all incoming requests of a virtualhost to the same 
ASP file. Is there a way I can do this without using mod_rewrite?
So I need
http://domain/whatever/andanythingelse
http://domain/whatever/hello.xyz?zoh=zoh
call the same
$documentroot/index.asp
which should be able to access the URI (in the original form).

Is this possible? How?

Thanx,
- Csongor



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Config question

Posted by "Fagyal, Csongor" <co...@conceptonline.hu>.
Thank you, Peter, it looks like this is exactly what I need!

- Csongor

>Fagyal, Csongor wrote:
>  
>
>>I would like to map all incoming requests of a virtualhost to the same
>>ASP file. Is there a way I can do this without using mod_rewrite?
>>So I need
>>http://domain/whatever/andanythingelse
>>http://domain/whatever/hello.xyz?zoh=zoh
>>call the same
>>$documentroot/index.asp
>>which should be able to access the URI (in the original form).
>>
>>Is this possible? How?
>>    
>>
>
>In my config, I map a specific pattern through to an ASP, but you could just
>match anything:
>
>httpd.conf:
>
>PerlTransHandler Some::Redirect;
>
>startup.pl:
>
>...
>package Some::Redirect;
>
>use Apache::Constants qw(:common);
>
>sub handler
>{
>        my $r = shift;
>
>        # match 16 hex digits (hand edited for e-mail example)
>        if ($r->is_initial_req && $r->uri =~ m|^/([\da-f]{16})?$|) {
>                if ($r->args) {
>                        $r->args($r->args . "&ref=$1");
>                } else {
>                        $r->args("ref=$1");
>                }
>                $r->uri("/something.asp");
>        }
>
>        return DECLINED;
>}
>
>
>Peter
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Config question

Posted by Peter Galbavy <pe...@photasmagoria.com>.
Fagyal, Csongor wrote:
> I would like to map all incoming requests of a virtualhost to the same
> ASP file. Is there a way I can do this without using mod_rewrite?
> So I need
> http://domain/whatever/andanythingelse
> http://domain/whatever/hello.xyz?zoh=zoh
> call the same
> $documentroot/index.asp
> which should be able to access the URI (in the original form).
>
> Is this possible? How?

In my config, I map a specific pattern through to an ASP, but you could just
match anything:

httpd.conf:

PerlTransHandler Some::Redirect;

startup.pl:

...
package Some::Redirect;

use Apache::Constants qw(:common);

sub handler
{
        my $r = shift;

        # match 16 hex digits (hand edited for e-mail example)
        if ($r->is_initial_req && $r->uri =~ m|^/([\da-f]{16})?$|) {
                if ($r->args) {
                        $r->args($r->args . "&ref=$1");
                } else {
                        $r->args("ref=$1");
                }
                $r->uri("/something.asp");
        }

        return DECLINED;
}


Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Config question

Posted by Quentin Smith <qu...@comclub.org>.
On Mon, 13 Oct 2003, Fagyal, Csongor wrote:

> Date: Mon, 13 Oct 2003 16:21:55 +0200
> From: "Fagyal, Csongor" <co...@conceptonline.hu>
> To: Quentin Smith <qu...@comclub.org>
> Cc: asp@perl.apache.org
> Subject: Re: Config question
> 
> Quentin,
> 
> >Hi-
> >I'll assume that you're running on Apache. This is ridiculously easy with 
> >Apache's mod_rewrite.
> >
> Well, it would be, but I want to do it without using mod_rewrite. First, 
> mod_rewrite is not available on the target server :-) Second, I also 
> want to do some other magic (for example authentication) - so Peter's 
> version is more suitable for what I need. But thanx!

Ooops. Didn't see that clause in your question :)
Sorry,
--Quentin

> 
> - Csongor


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Config question

Posted by "Fagyal, Csongor" <co...@conceptonline.hu>.
Quentin,

>Hi-
>I'll assume that you're running on Apache. This is ridiculously easy with 
>Apache's mod_rewrite.
>
Well, it would be, but I want to do it without using mod_rewrite. First, 
mod_rewrite is not available on the target server :-) Second, I also 
want to do some other magic (for example authentication) - so Peter's 
version is more suitable for what I need. But thanx!

- Csongor


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Config question

Posted by Quentin Smith <qu...@comclub.org>.
On Mon, 13 Oct 2003, Fagyal, Csongor wrote:

> Date: Mon, 13 Oct 2003 14:17:06 +0200
> From: "Fagyal, Csongor" <co...@conceptonline.hu>
> To: "'asp@perl.apache.org'" <as...@perl.apache.org>
> Subject: Config question
> 
> Hi,
> 
> I would like to map all incoming requests of a virtualhost to the same 
> ASP file. Is there a way I can do this without using mod_rewrite?
> So I need
> http://domain/whatever/andanythingelse
> http://domain/whatever/hello.xyz?zoh=zoh
> call the same
> $documentroot/index.asp
> which should be able to access the URI (in the original form).
> 
> Is this possible? How?

Hi-
I'll assume that you're running on Apache. This is ridiculously easy with 
Apache's mod_rewrite. Basically, you just turn rewrite on and direct every 
request to your script. Put lines like this in the appropriate section of 
your httpd.conf (a Location or VirtualHost, perhaps):

RewriteEngine On
RewriteRule ^/(.*) /index.asp/$

If you're on Apache 2, you might also need:

AcceptPathInfo On

Then you can access the incoming path as PATH_INFO in 
$Request->ServerVariables("PATH_INFO").
HTH,
--Quentin

> 
> Thanx,
> - Csongor


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org