基本语法
在主题/main.php的开头加入以下代码:
if ($_SERVER[HTTPS]!="on") { $strURIName=$_SERVER['SERVER_NAME'] . getenv("REQUEST_URI"); // The function 'getenv' does not work if your Server API is ASAPI (IIS). So, try to don't use getenv('REMOTE_ADDR'), but: // $_SERVER["REMOTE_ADDR"]. $strURIName=$_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; header ("Location: https://$strURIName"); // If it doesn't work for you and you need to troubleshoot your php code, uncomment below to find out about your particular server variables. /* echo "<b>_SERVER Variables from $_SERVER</b><br><br>"; reset($_SERVER); while (list ($key, $val) = each ($_SERVER)) { print $key . " = " . $val . "<br>"; } */ }