您现在的位置是:芭奇站群管理系统 > 学习收录 > -> PHP跳转功能代码

PHP跳转功能代码

时间:2010-05-20 21:38

PHP跳转功能代码

<?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);
}
}
?>


<?php
if ($_SERVER["SERVER_NAME"]=="www.163.com"){
if ($_SERVER["HTTPS"]<>"on"){
$xredir="https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
header("Location: ".$xredir);
}}
?>

 

<?php
$aaa=$_SERVER["SERVER_NAME"];
if ($aaa=="www.163.com"){
echo $aaa;
}
else{
echo "ddddddd";
}
?>