By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,657 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Warning: Cannot modify header information

100+
P: 142
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
Dec 14 '07 #1
Share this Question
Share on Google+
3 Replies


100+
P: 142
I see on some hosting servers it works and other servers it does not work.

Any advice?
Dec 14 '07 #2

nathj
Expert 100+
P: 938
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
Hi,

I think the problem is the spaces in the code. This can be read as outout which then means that headers can't be set. Try the code without the indentation.

Normally I'm all for indentation, it makes life easier when maintaining code but in this case I think it means the code won't work.

Give it a try and see if it solves the problem.

Cheers
nathj
Dec 14 '07 #3

Markus
Expert 5K+
P: 6,050
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
That script works fine for me..
Dec 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.