Home >Backend Development >PHP Tutorial >Determine whether it is HTTPS and jump
At the beginning of PHP running, check whether it is an HTTPS link, if not, jump
switch (TRUE) { case (!isset($_SERVER['HTTPS'])) : function RedirectToHttps(){ case ($_SERVER['HTTPS']!="on") :
$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; header("Location:$redirect"); exit; }
|