header('Location: ' . $url);
I've checked that there is no previous output:
ob_start();
...
var_dump(ob_get_contents());
ob_flush();
header('Location: ' . $url);
outputs:
string '' (length=0)
Then why does the redirect fail?
Though I see lots of warnings and notices in the error_log
,but that doesn't affect header()
as long as it doesn't output anything to the browser,right?
UPDATE
Some logs(should not be related though):
[Wed May 19 00:26:10 2010] [error] [client 127.0.0.1] PHP Deprecated: Function eregi() is deprecated in D:\\Works\\general
[Wed May 19 00:26:10 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/cookie_usage.php
[Wed May 19 00:26:10 2010] [error] [client 127.0.0.1] PHP 1. {main}() D:\\Works\\login.php:0, referer: http://localhost/cookie_usage.php
[Wed May 19 00:26:10 2010] [error] [client 127.0.0.1] PHP 2. tep_redirect() D:\\Works\\login.php:33, referer: http://localhost/cookie_usage.php