I'm having trouble understanding how header("Location: http://www.google.com/"); may work in the middle of the <body> HTML page.
There should be no error, since the header has already been sent due to HTML output before the start of <?php ... ?> .
I am referring to the Cannot modify header information - headers already sent by... warning that I expect to receive.
I am testing this in my local PHP dev environment (Apache / 2.2.15 (Win32) PHP / 5.3.2).
Here is an example:
<html> <head> </head> <body> <?php header("Location: http://www.google.com/"); ?> </body> </html>
Any ideas? Thanks.
source share