当前位置: 移动技术网 > IT编程>网页制作>CSS > 多中语言实现判断客户访问用得是那个域名 然后转到对应的目录

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

2017年12月12日  | 移动技术网IT编程  | 我要评论

思绪飘零,sunny day 藤木一惠,湖南卫视跨年晚会节目单

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网