Gossamer Forum
Home : General : Perl Programming :

print "Location: http://yahoo.com\n" ; doesn't worl on NT - pls help !

Quote Reply
print "Location: http://yahoo.com\n" ; doesn't worl on NT - pls help !
Hello !

I'm using NT server - I don't know why in this server I got the error when I use the code :

$url ="http://yahoo.com";

print "Location: $url\n";

The error was : the script writes the text below on the browser :

Location: http://yahoo.com

I have used the code above on some other NT server and it worked - Anyone can tell me why in this current NT server I got the text output on the browser instead direct to yahoo homepage?

Please help !

Thanks !
Quote Reply
Re: [newage24] print "Location: http://yahoo.com\n" ; doesn't worl on NT - pls help ! In reply to
I very much doubt it ever worked on any server Wink

The problem with you code is you only used 1 \n. For this feature you need to use 2, \n\n.

Try;

print "Location: $url \n\n";

also, remember NOT to print any other content-type headers before it, as that will cause the redirect to just be printed, or in many cases cause a 500 Internal Server Error.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] print "Location: http://yahoo.com\n" ; doesn't worl on NT - pls help ! In reply to
Code:
use CGI qw(:standard);
print redirect("http://www.yahoo.com");

--Philip
Links 2.0 moderator