I have my website hosted on 000webhost a year ago. Everything were working fine, however a 2 weeks ago I notice that the redirect header no longer working while it still working on XAMMP server.
I have this code to redirect the user once they logout to index page.
>
<?php
session_unset();
session_destroy();
echo "<div class='centerMsg'>";
echo "<h2 class='green'> Thank you </h2>";
echo "<h3 class='green'>You will be redirected to the home page now</h3>";
echo "</div>";
header('Refresh: 2; URL=index.php');
?>
</div>
I have not changed anything. Why it is stop working?
Problem solved. Please clear your browser cache and try again.
All headers must be sent before the actual content is delivered. If you want to do otherwise additional configuration from .htaccess is required and ob_start()/ob_end_flush() must be used as well.