header() sometimes fails, sometimes works, same url

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

        header('Pragma: no-cache');                        // ENSURE CLIENT-SIDE CACHE FLUSHING
        $url = "$projectURLPath/index.php";
        if ($_REQUEST['logoutMsg']) $url .= '?logoutMsg='.
        if ($willAuthenticate && $willUseSSL) {
         $dest = 'https://' . $_SERVER['SERVER_NAME'] . $url;
        } elseif ($willBasicAuthenticate && $willUseSSL) {
         $dest = 'https://EnterYourUserName:EnterPassword@' .
        } elseif ($willAuthenticate) {
         $dest = 'http://' . $_SERVER['SERVER_NAME'] . $url;
        } elseif ($willBasicAuthenticate) {
         $dest = 'http://EnterYourUserName:EnterPassword@' .
        header("Location: $dest");                            // DEFAULT REDIRECT TO MAIN PAGE


This code scriptlet will allow for redirection to dynamically relocate
to another URL.  However, for some bizarre reason, it will not redirect
anywhere; it just dies (no warnings, no errors, no notices, no
nothing!), however, if you refresh your browser, the redirected page
appears, sometimes after 1, 2, 3 tries.  Then sometimes it redirects
with no problems at all.

I tried closing my browser, logging out, refreshing everything,
deleting cache/history.. to no avail.

This only started occurring the moment I used my SessionHandler class
to relocate session files elsewhere due to a business requirement - the
moment I removed SessionHandler, this redirection weirdness occurred
and no amount of debugging seems to be able to solve the problem.

Ideas? Help?


Site Timeline