There was something strange going to the new server.
I have a script that redirects users to another web page based on certain conditions. However, what I did repeats "Redirecting ..." and then uses the header () function to actually redirect. This is what the code looked like:
if( $condition ) { echo 'Redirecting...'; header( 'Location: ' . $url ); }
Now I just noticed that this is not right after switching to our new server, tested it and saw that it does NOT redirect only output redirection ... and as soon as I searched about it, I found out that you cannot have any (other than using ob_start, etc.) before using the header () function.
The question is why this code, which should NOT work in ANY PHP installation, works on my old server? It will redirect with an echo before the header () without any problems.
Thanks!
redirect php header
Bill haynek
source share