Ok, my question is...

Why is it that when i uploaded my files to the server the

header("Location:".$config_basedir.");

wont execute more than once....

But on my Localhost I had no problem with the header refreshing...


Is there a way to stop this from happening or maybe a revise PHP code I can use to let it use header feature????


Thanks in advance for the help.

-Programmer12

You can use Javascript inside a php function to control your redirects.

<?php

    redirect("www.redirecting.com/page.php"); 

    function redirect($url)
    {
?>
        <script type="text/javascript">
		window.location = "<?php echo $url ?>"
        </script>
<?php
    }
?>

I bet your script has sent some kind of output before it reaches your header command on the server (probably a warning or error message). Try this:

// If no headers are sent, send one
if (!headers_sent()) {
    header("Location: $config_basedir");
    exit;
} else {
    echo "<pre>Error: Cannot redirect, headers have already been sent.\n";
    var_dump(headers_list());
    die;
}