Given the following code (and only this code):
<?php
if (headers_sent()) {
die('cannot send location header (anymore)');
}
else {
header("Refresh: 0; url=http://www.google.com"); //This does not work
//header("Location: http://www.google.com"); //This does work
die();
}
?>
Does anyone have any thoughts/suggestions why this will not work on a particular network?
The above codes directs to Google on 3 of the 4 networks I have tested (home, my work, a friend’s home network).
However, when I load this page on my client’s network, he only gets a blank page.
The commented code above is my workaround…but I would really love to know why Refresh would not work on this one particular network.
Refresh is not an official HTTP header field. Although HTML’s
METAelement withhttp-equivattribute might implicate that anything that works there should also work with the real HTTP, Refresh was never an actual HTTP header field (andhttp-equivdoes not mean HTTP-equivalent).Just use the standard Location instead.