develooper Front page | perl.beginners | Postings from December 2002

Re: problems with redirect page

Thread Previous | Thread Next
From:
Michael Kelly
Date:
December 4, 2002 21:52
Subject:
Re: problems with redirect page
Message ID:
20021205055130.GA15209@dt093n0d.san.rr.com
On Wed, Dec 04, 2002 at 09:04:50PM -0600, perl wrote:

Hi Josh,

> I'm trying to make a page redirect to a homepage if a user has logged in 
> before.  I have everything running except the redirect command.  Here's 
> what I have: 
> 
> print redirect ( "homepage.pl" ); 
> 
> 
> It gives me a message on the page that says: 
> 
> Status: 302 Moved location: homepage.pl 
> 
> What am I doing wrong?  The file homepage.pl is in the same directory as 
> the file that the above code is on.  Any ideas? 

You're probably running redirect() after you've already printed your
HTTP headers. Do something like
	
	print "Content-type: text/html\n";
	print redirect('homepage.pl');
	print "\n";

That puts your redirect in the headers, where it should be.

> Thanks! 
> Josh 

HTH,
-- 
Michael
jedimike@san.rr.com
http://www.jedimike.net/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About