实现单根目录多站跳转的ASP代码
网络整理 - 09-03
现在很多虚拟主机系统已经可以实现子目录绑定,但还有部分虚拟主机提供商不支持多个网站共享一个根目录。如果你想在一个虚拟主机空间中放多个网站,此时可以通过ASP代码进行判断来实现。代码如下:<%
dim d_name
'获取用户访问的域名
d_name=Request.servervariables("server_name")
'请求,跳转至WWW子目录
if instr(d_name,"")<>0 then
response.redirect("/www/index.asp")
'请求www1.cuoxin.com,跳转至WWW1子目录
esleif instr(d_name,"www1.cuoxin.com") then
response.redirect("/www1/index.asp")
'也可以通过IFRAME来实现隐藏真实路径
elseif instr(d_name,"www3.cuoxin.com") then
%>
<iframe src="/www2/index.asp" height="100%" width="100%" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="yes" ></iframe>
<%
end if
%>
