http直接跳转为https,重定向一下就可以了。用php就更简单了:
<?php
header("Location:https://www.nowamagic.com");
?>
当访问 http 时,跳 https:
<?php
//http转化为https
if ($_SERVER["HTTPS"] <> "on")
{
$xredir="https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}
?>
当访问 https 时,跳 http:
<?php
//https转化为http
if ($_SERVER["HTTPS"] == "on")
{
$xredir="http://".$_SERVER["SERVER_NAME"]. $_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}
?>
在网页开头包含上面代码即可。
(欣才PHP培训)