I realized that I have a mismatch between my stage server and the one I have localhost.
I have made some mistake with the header sent twice. Unfortunately on my localhost everything works fine but on the stage server I get a correct warning:
"Warning: Cannot modify header information - headers already sent by"...
Is this some configuration tweak on my Apache?
Stage is running on GoDaddy/linux (Apache/version?), PHP Version 5.4.19
Localhost is Apache/2.4.6, php 5.5.3-1ubuntu2.1
Edit:
Some sample code, that hopefully will clarify...
On my localhost the page is redirected every time without error, the output text "Page redirect done!" is shown on every refresh.
On the stage, this error is reported "Warning: Cannot modify header information - headers already sent by", the output text "Page redirect done!" is not shown at all.
<?php
ini_set("display_errors", true);
error_reporting(E_ALL);
if (!isset($_SESSION)) {
session_start();
}
?>
<html><body><h1>It works!</h1>
</body></html>
<?php
if (isset($_SESSION['redirect'])) {
unset($_SESSION['redirect']);
echo "Page redirect done!<br><br>";
echo "Session redirect is now unset, please update one more time to be sure!";
} else {
$_SESSION['redirect'] = "1";
header("Location: index.php");
}
?>
Thanks!