You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by FF...@Exchange.WebMD.net on 2002/10/02 18:34:27 UTC

Easy internal redirect question

I call a page, /my/script1?task=foo which does some things and then needs to
redirect to /my/script2?task=bar.  However, putting 

$r->internal_redirect('/my/script2?task=bar');

doesn't seem to work as script2 is seeing task=foo rather than task=bar.
Looks like the internal_redirect is also passing along the form params to
the second request.  How is this avoided?  I'm looking through the cookbook
recipe on internal redirects but nothing is jumping out at me at the moment.

Thanks,
Fran

Re: Easy internal redirect question

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

FFabrizio@Exchange.WebMD.net wrote:
> I call a page, /my/script1?task=foo which does some things and then needs to
> redirect to /my/script2?task=bar.  However, putting 
> 
> $r->internal_redirect('/my/script2?task=bar');
> 
> doesn't seem to work as script2 is seeing task=foo rather than task=bar.
> Looks like the internal_redirect is also passing along the form params to
> the second request.  How is this avoided?  I'm looking through the cookbook
> recipe on internal redirects but nothing is jumping out at me at the moment.

that's pretty odd.

given two scripts, one.pl:

shift->internal_redirect('/perl-bin/two.pl?internal=redirect');
return Apache::OK;

and two.pl:

my $r = shift;
$r->send_http_header('text/plain');
print "args is ", scalar $r->args, "\n";

I get the right results:

$ GET localhost/perl-bin/one.pl?main=request
args is internal=redirect

are you returning OK right after your internal redirect?  does setting 
$r->args() before calling the internal redirect to a third value 
change anything?

--Geoff