Page 1 of 1

Header redirect fails

Posted: Thu Nov 05, 2009 10:00 am
by powrtoch
I know this first thing you think is "no output to the browser before the header function". There isn't any. No tags, no spaces, no line breaks, nothing. I don't even have a "headers already sent" error displaying. For some reason though, the redirect simply does not work, and my script indicates that headers are getting sent anyway. I go to the page, and I just get a blank page with the undirected url up top. Is there some php configuration variable that could cause this to fail?

Here is my ENTIRE script.

Code: Select all

<?php
    $a = headers_sent();
    header("Location: http://google.com");
    $b = headers_sent();
    echo "$a<br />$b";
    exit();
?>
The output is:
1
1

Obviously the first one should not be a 1. Any thoughts? I'm going nuts here.

Re: Header redirect fails

Posted: Thu Nov 05, 2009 11:37 am
by davegmpd
You could try a combination of the Firefox "Live HTTP Headers" plugin (to see what's going back and forth) and also potentially this:

Code: Select all

 
ob_end_clean();
 
See if that makes any difference.

Are you sure there's not output ;)

Dave