Ian Grant wrote: > Dear mod_perl types, > > A system I have installed relies on doing redirects like the code below, but > the redirects don't happen, I just get blank pages in the browser. > > I have tested temp redirects in httpd.conf and they work fine. > > Can anyone tell me if the code below should work, or is there something I > need > to call to get the Location header output? > > use strict; > > use Apache2::RequestUtil (); > > my $request=Apache2::RequestUtil->request(); > my $url='https://www.some.place.ac.uk/perl/newscript'; > > $request->status_line("302 Moved");
don't alter the status line directly. instead use $request->status(302); from Registry scripts. once you move to proper mod_perl handlers, simply calling return Apache2::Const::REDIRECT; is sufficient - no call to $request->status() required. > $request->headers_out->{'Location'} = $url; > print STDERR "redir: redirecting to $url\n"; > > exit; better form to return Apache2::Const::REDIRECT; than to call exit - since mod_perl processes never really exit this call ends up being overridden anyway. just fyi :) HTH --Geoff