You did not specify a redirect location.
Must be:
header("Location:http://example.com/login.php");
Thus, when you log out, it redirects the browser to login.php.
EDIT:
In addition, this will help add a session verification condition to the home page.
Feel like:
if(!isset($_SESSION))
{
header("Location:http://example.com/login.php");
}
source
share