Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php redirect

3:38 pm on Aug 21, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 15, 2002
votes: 0

How can you execute a redirect using php from within an HTML document, without using javascript? Is it possible, would you have to put some php command in the <head></head> section? If I try to use header() function, it says error: header has already been sent...
3:42 pm on Aug 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
votes: 0

Yes, a common newbie error.

You must send any headers including calls to session_start() session_register() and set_cookie before you send any other headers, like this:

if(!$username) {
header("Location: /login.php");
etc etc....


3:54 pm on Aug 21, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 2, 2002
votes: 0

I always insist to place
right after the
header("location: url.html");

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members