if (!ValidateUser($SESSION["user"], $SESSION["pass"]))
{
header("Location: " . INDEXPATH);
exit;
}
The above is an example in which I use in scripts. Before you output anything to the client, you must make a decision whether or not to redirect them to another place.
If you want everyone to be immediately redirected to another page when they come to a particular one, then I would do this:
<?php
header("Location: [url]https://somwhere.com[/url]");
exit;
?>
The exit is important in that it makes the php script stop there because if not, it will continue through the script when you do not want it to.
Hope this helps!