Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

mod_perl redirect

by srchulo (Sexton)
on Jan 15, 2012 at 02:59 UTC ( #947934=perlquestion: print w/ replies, xml ) Need Help??
srchulo has asked for the wisdom of the Perl Monks concerning the following question:

So I'm working in a mod_perl environment, and I want to know what the best way is to redirect to a new url. I know in CGI Perl you use print "Location:...", however I've come to find that usually there are better ways to do things in mod_perl, but I can't seem to find anything. Thanks in advance!

Comment on mod_perl redirect
Re: mod_perl redirect
by Anonymous Monk on Jan 15, 2012 at 03:36 UTC
Re: mod_perl redirect
by cavac (Chaplain) on Jan 15, 2012 at 08:41 UTC

    It's pretty much the same all around. You are generating a "Location" HTTP header and are (hopefully) using the correct HTTP status code, depending on what exactly you are trying to do.

    Here's the definition of HTTP/1.1 status codes, look at 303 and 307. The main difference between those is how POST is handled.

    "Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupidů and I went ahead anyway." (Crow in "MST3K The Movie")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://947934]
Approved by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2015-03-05 16:30 GMT
Find Nodes?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:

    Results (147 votes), past polls