黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图
您现在的位置: 黑客风云 >> 黑客文章 >> 网管频道 >> 网站建设 >> 文章正文
[推荐]同一空间绑定多个域名而实现访问不同的页面代码,PHP,jsp和ASP代码
        ★★★★★
同一空间绑定多个域名而实现访问不同的页面代码,PHP,jsp和ASP代码
文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2006-12-11

第一段 PHP 代码

<?php
switch ($_SERVER["HTTP_HOST"]) {
 case "www1.aspcn.net":
   header("location:index1.htm");
   break;
 case "www2.aspcn.net":
   header("location:index2.htm");
   break;
 case "www3.aspcn.net":
   header("location:index3.htm");
...... 继续添加 ......
   break;
}
?>

第二段 ASP 代码

1.
<%
select case request.servervariables("http_host")
case "www1.aspcn.net"
Server.Transfer("index1.htm")
case "www2.aspcn.net"
Server.Transfer("index2.htm")
case "www3.aspcn.net"
Server.Transfer("index3.htm")
...... 继续添加 ......
end select
%>

2.
<%if Request.ServerVariables("SERVER_NAME")="www.ww.com" then
response.redirect "rww/"
else%>
<%end if%>
<%if Request.ServerVariables("SERVER_NAME")=www.ww.net then
response.redirect "ww/"
else%>
<%end if%> 

3.
<%
if Request.ServerVariables("SERVER_NAME")="www.rwen.com" then
response.redirect "wwwen/index.asp"
else
response.redirect "websites/"
end if
%>

4.
<%
from=lcase(Request.ServerVariables("HTTP_HOST")) 
if left(from,4)="www." then
  Response.redirect("index.asp")'此处为网站首页地址
else
  response.Write( "<frameset><frame src=""blog.asp?domain="&from&"""></frameset>")
end if
%>

第三段 JSP代码:

<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> 

文章录入:cainiaowang    责任编辑:cainiaowang 
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
VIP 专 区
Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
ICP备案:冀06009886