打开HTTPS后,PHP标题('Location:index.php')无效

After enabling HTTPS on the website my location headers don't respond anymore. Never had this problem before.

I've tried different thing to fix it, but it still won't work

<?php
include('check.php');

header("HTTP/1.1 200 OK");
if(empty($_SESSION)){


} else {
    header("Location: http://example.com/admin.php");
}
?>

header("Location: http://example.com/admin.php"); should be the first output done in a script ..

You need to remove the header("HTTP/1.1 200 OK"); statement or pu it inside the if condition like so:

<?php
include('check.php');
if(empty($_SESSION)){
    header("HTTP/1.1 200 OK");
} else {
    header("Location: http://example.com/admin.php");
}
?>

also make sure nothing is echoes /printed out in check.php as nothing should be echoed out before the header() function.