You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Cédric Bertolini <be...@gmail.com> on 2010/05/07 12:44:54 UTC

Handling visible redirects

Hi everyone,

I have a problem and I can't figure a solution, so I'm asking here, hoping
not to bother.

I have a perl script that takes a FILEPATH and should redirect to the
FILEPATH on the server. Everything works fine in my setup with the help of a
$r->handler(Apache2::Const::DIR_MAGIC_TYPE) in PerlFixUpHandler.

But my problem is that the redirection is not visible to the client. Its url
doesn't change, but I want it to change to the FILEPATH. In fact, the
response has a status code of 200, because the redirect is handled
internally by Apache (or mod_perl ?). I tried to return Apache2::Const::OK
instead of REDIRECT, but it didn't change the internal redirect.

I'd rather not use mod_rewrite.

It worked as expected on Apache1.3/mod_perl1... The url redirect was visible
to the user.

So my question is : how can I respond with a 301 or 307 Redirect to the
client?

Thanks for your time,
Cédric Bertolini

Re: Handling visible redirects

Posted by Torsten Förtsch <to...@gmx.net>.
On Friday 07 May 2010 12:44:54 Cédric Bertolini wrote:
> So my question is : how can I respond with a 301 or 307 Redirect to the
> client?
> 
$r->err_headers_out->{Location}='http://...';
return 301;  # or 302 or 303 or 307

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net