
sleuth
Enthusiast
Dec 12, 2000, 4:24 PM
Post #2 of 2
(3157 views)
|
|
Re: How do I redirect to another page?
[In reply to]
|
Can't Post
|
|
Also be sure that when you want to redirect you must not send the content type header to the browser, you must leave the line print "Content-type: text/html\n\n"; OUT of your script for this to work. If you need to print "Content-type: text/html\n\n"; and redirect under a different circumstance in the same script, you could try using an if else statement If (something){ print "Content-type: text/html\n\n"; # and other code } else { print "location: http://www.perlguru.com\n\n"; # just redirect } Another way to redirect in plain HTML is by printing a Meta refresh tag, like so <meta HTTP-EQUIV="REFRESH" CONTENT="0 URL=http://www.perlguru.com"> 0 being the amount of time in seconds, you can change this to 2, 60 or whatever. If you don't specify a URL it will simply refresh the url that your script is running from or the page that contains the tag. if you need to use the meta refresh tag instead of the print location method, then you MUST print "Content-type: text/html\n\n"; Sleuth
|