Tuesday December 03, 2002
internal redirect, apache mod_cgi, and CGI.pm
Recently, there's been a discussion on PerlMonks about how an internal redirect wasn't working. I traced it down to a few lines of mod_cgi.c in the Apache source code. For an internal redirect, a location header must be present, begin with a slash (no hostname) and
the status must be 200.
Unfortunately, the standard CGI.pm redirect routine defaults the status to be 302. Thus, you have to remember to write the redirect as
print redirect(-uri => '/new/location', -status => 200);