[返回首页]
 ◎ 您当前的位置:首页 >> 站长学堂 >> 源码大全 >> 正文
多域名同一空间的处理实例(PHP,ASP,JS)
作者:未知 来源:网上收集 发布时间:2007-3-23 22:17:05

两个域名都是绑在同一个空间上,但会跳到不同的目录,不是在IIS设置上实现的,只是一小段代码.我找了找,找了到下面几种,各种语言的!保留下,以后说不定有用.

ASP:

<%
'取得HTTP输入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'开始条件跳转
SELECT CASE host
' 如果HOST的值是www.iswind.net就选择事件case"www.iswind.net"的命令
CASE "www.iswind.net"
' Below is the redirect command
response.redirect "bbs/"
CASE "www.gdvet.com"
response.redirect "inc/"
'We use CASE ELSE to fix any other requests
CASE ELSE
response.redirect "inc/"
END SELECT
%>


PHP:

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



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>



[返回上一页] [打 印]
热点文章 推荐文章
·使用301重定向
·时间、空间性能极优的asp无组件上传类
·whois信息查询大全
·鼠标经过就跳出的代码
·四大机器人的代码
·实现百度站内搜索的代码
·让广告代码不再影响你的网页加载速度
·打开网页自动设为首页代码
·适合本blog的一个精美javascript日历
·挂QQ的上下线和隐身
·让网页跳转的几种方法
·滚动条特效代码收集