国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

多中語言實現判斷客戶訪問用得是那個域名 然后轉到對應的目錄

2020-10-23 18:41:04
字體:
來源:轉載
供稿:網友

多中語言實現判斷客戶訪問用得是那個域名 然后轉到對應的目錄 
asp版:

發表多個綁定多域名的ASP代碼

如果有有一個ASP空間,而你又想放置多個多個站點,這些代碼可以幫到你
第一個 
<%if Request.ServerVariables("SERVER_NAME")="bbs.along.com.ru" then
response.redirect "bbs"
else
response.redirect "index1.htm"
end if%>

第二個
<%
select case request.servervariables("http_host")
case "www.along.com.ru" '1
Server.Transfer("along.htm")
case "www.along.net.ru" '2
Server.Transfer("net.htm")
case "www.null.com.ru" '3
Server.Transfer("null.htm")
...... 繼續添加 ......
end select
%>

第三個
<%if instr(Request.ServerVariables
("SERVER_NAME"),"fjsky.info")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.com.ru")>0 then
response.redirect "x/index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.net.ru")>0 thenr
esponse.redirect "index3.asp"
end if
end if
end if%>

第四個
<%if Request.ServerVariables("SERVER_NAME")="www.fjsky.info" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="fjsky.info" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="www.null2.com.ru" then
response.redirect "/web/index.asp"
else if Request.ServerVariables("SERVER_NAME")="null2.com.ru" then
response.redirect "/web/index.asp"
end if
end if
end if
end if%>

第五個
<% 
'取得HTTP輸入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'開始條件跳轉
SELECT CASE host
' 如果HOST的值是www.iswind.net就選擇事件case"www.iswind.net"的命令
CASE "www.abc.net"
' Below is the redirect command
response.redirect "web/"
CASE "www.efd.com"
response.redirect "web1/"
'We use CASE ELSE to fix any other requests
CASE ELSE
response.redirect "web1/"
END SELECT 
%> 

js版:
<script>
try 
{ if( self.location == "http://玉米一/" ) 
{
top.location.href = "http://玉米一/目錄";
}
else if( self.location == "http://玉米二/" ) 
{
top.location.href = "http://玉米二/目錄";
}
else if( self.location == "http://玉米三/" ) 
{
top.location.href = "http://玉米三/目錄";
}
else if( self.location == "http://玉米四/" ) 
{
top.location.href = "http://玉米四/目錄";
}
else 
{ document.write ("錯誤的訪問地址") } 

catch(e) { }
</script> 




case "domain.com":
header("location:blog");
break;
default:
header("location:news");
break;
}
?>

或者

<?php
$domain_net="yeahe.com";
$dot_net_url="bbs/";
$dot_com_url="flash";
if(($HTTP_HOST=="$domain_net")or($HTTP_HOST=="www.$domain_net"))
{
Header("Location: $dot_net_url");
}
else
{
Header("Location: $dot_com_url");
}
?>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 招远市| 张家界市| 博罗县| 乌兰浩特市| 香港| 册亨县| 攀枝花市| 海口市| 剑河县| 宽甸| 珠海市| 安徽省| 十堰市| 钟山县| 绿春县| 兰溪市| 望江县| 沁阳市| 徐水县| 子洲县| 内乡县| 旬邑县| 卫辉市| 香河县| 邛崃市| 万全县| 营山县| 涞水县| 康平县| 高雄县| 婺源县| 龙南县| 内江市| 玉林市| 达州市| 鞍山市| 西平县| 本溪| 杭锦旗| 太白县| 锡林郭勒盟|