更新时间:2023-12-01 19:40:22
我以前做过的方式基本上就像你写的那样,但没有任何硬编码值:
The way I've done it before is basically like what you wrote, but doesn't have any hardcoded values:
if($_SERVER["HTTPS"] != "on")
{
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit();
}