Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirection

Status
Not open for further replies.

audiopro

Programmer
Joined
Apr 1, 2004
Messages
3,165
Location
GB
I have searched the FAQ's but cannot find a definitive example of redirection.
I have found the following code but I am not sure if this is the correct approach.
Code:
print $query->redirect($url);
I have a script which parses incomming data. If the data passes a series of tests then the visitor is redirected to another site. If the checks fail then a page is displayed to reflect this.
How do I do the actual redirection?

Keith
 
Not positive, but I think as follows:

Code:
print <<EOF;


Location: [URL unfurl="true"]http://www.redirectsite.com/new_location.htm[/URL]

EOF


Michael Libeson
 
why dont you try something like this
Code:
print '<META HTTP-EQUIV="Refresh" 
CONTENT="0; URL=/your_new_location/your_html.html">';
its the old way but i like it.

TIMTOWTDI
 
The code you found is, IMO, the cleanest way to achieve a redirect. You need to be using the CGI.pm module to run that code:
Code:
use CGI;
my $query = new CGI;
my $url = '[URL unfurl="true"]http://www.example.com';[/URL]
print $query->redirect( $url );
As long as you don't print out anything else before that print statement, it will redirect to $url.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top