网络编程 
首页 > 网络编程 > 浏览文章

多中语言实现判断客户访问用得是那个域名 然后转到对应的目录

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )

多中语言实现判断客户访问用得是那个域名 然后转到对应的目录 
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");
}
?>

上一篇:关于margin-left的示例代码
下一篇:css——之三行三列等高布局图文教程
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网