PHP跳转功能代码
if ($_SERVER["SERVER_NAME"]=="www.163.com"){
if (($_SERVER["REQUEST_URI"]<>"/index.htm") and ($_SERVER["REQUEST_URI"]<>"/default.php")){
if ($_SERVER["HTTPS"]<>"on"){
$xredir="https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}
}
elseif ($_SERVER["REQUEST_URI"]=="/default.php"){
$xredir="https://".$_SERVER["SERVER_NAME"]."/index.htm";
header("Location: ".$xredir);
}}
else{
if ($_SERVER["HTTPS"]=="on"){
$xredir="http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}
}
?>
if ($_SERVER["SERVER_NAME"]=="www.163.com"){
if ($_SERVER["HTTPS"]<>"on"){
$xredir="https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}}
?>
$aaa=$_SERVER["SERVER_NAME"];
if ($aaa=="www.163.com"){
echo $aaa;
}
else{
echo "ddddddd";
}
?>