Hi All
I'm using the following command to redirect the user to another page.
header( "location: http://www.msn.com\r\n" );
But I allways received the following error message.
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/redirect.php:19) in /var/www/html/redirect.php on line 88
Does anyone can tell me what's the problem since I think I didn't send any headers before this command is executed.
thanks
Redirect to Another Page
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
...
Yeah you have to make sure that the header is the FIRST thing that you send to the user. So make sure you have echoed anything, or put html before the php script etc.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Your getting the error because that method of refreshing is horrible. Heres my simple method I always use
Code: Select all
<?
echo ("<meta http-equiv='refresh' content="0;URL=www.google.com'>");
?>
it will work no matter where it echos.-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA