一个空间/虚拟主机放置多个网站的转向代码(多个域名绑定一个空间)
分类:程序开发 Tags: 多站点 评论:2 浏览:9079 最近更新时间:2007/3/22 17:40:34
申请了几个域名,可是空间(虚拟主机)只有一个,在网上找到了这段代码,贴上来给大家分享,我的域名有:
www.yuzhiguo.com.cn
www.yuzhiguo.com
www.yuzhiguo.cn
www.poyangwz.com.cn
www.poyangwz.cn
总共五个,前三个代码里都是转到:“index.asp”页面,后两个是转到“pywz/index.asp”页面,
代码里:Response.Write( "<frameset><frame src='../pywz/index.asp'></frameset>")是使用了框架模式,对后面的路径进行了隐藏。
有不懂的地方可以加我QQ。
代码如下:(保存为dns.asp放置在网站根目录,并在主机控制面板设置dns.asp为最优先访问的页面,比index.asp和index.html等都优先才行哦)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<%
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
dim sURL
sURL=Request.ServerVariables("HTTP_HOST")
if InStr(sURL,"=")<>0 or InStr(sURL,"`")<>0 or InStr(sURL,"'")<>0 or InStr(sURL," ")<>0 or InStr(sURL," ")<>0 or InStr(sURL,"'")<>0 or InStr(sURL,chr(34))<>0 or InStr(sURL,"\")<>0 or InStr(sURL,",")<>0 or InStr(sURL,"<")<>0 or InStr(sURL,">")<>0 then
Response.Status= "404 no found"
Response.End
end if
if InStr(sURL,"www.yuzhiguo.com.cn")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"yuzhiguo.com.cn")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"www.yuzhiguo.com")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"yuzhiguo.com")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"www.yuzhiguo.cn")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"yuzhiguo.cn")<>0 then
Response.Redirect ("index.asp")
Response.End
end if
if InStr(sURL,"www.poyangwz.com.cn")<>0 then
Response.Write( "<frameset><frame src='../pywz/index.asp'></frameset>")
Response.End
end if
if InStr(sURL,"poyangwz.com.cn")<>0 then
Response.Write( "<frameset><frame src='../pywz/index.asp'></frameset>")
Response.End
end if
if InStr(sURL,"www.poyangwz.cn")<>0 then
Response.Write( "<frameset><frame src='../pywz/index.asp'></frameset>")
Response.End
end if
if InStr(sURL,"poyangwz.cn")<>0 then
Response.Write( "<frameset><frame src='../pywz/index.asp'></frameset>")
Response.End
end if
%>
大家可以根据自己的需要灵活运用哦,这样只要你的空间可以绑定多个域名你就可以建多个网站了,很爽吧!
其他代码
- <%
- select case request.servervariables("server_name")
- case "www.网址.com"
- server.transfer("home.asp")
- case "en.网址.com"
- server.transfer("english.asp")
- case "cn.bclele.com"
- server.transfer("chinese.asp")
- end select
- %>
-
• asp多条件查询sql语句用法,可用于搜索、筛选模块
• centos系统挂载数据盘方法
• 中国十大ASP CMS系统介绍
• 利用ASPJPEG为图片加水印及制作缩略图代码
• ASP过滤所有超链接代码
• 网页设计中DIV+CSS常用命名规则
• ASP随机读取数据库中几条数据代码
• MySQL报Field‘***’doesn’t have a default value错误的解决办法
• UEditor百度编辑器在html代码模式无法更新内容的解决办法
• 打开网页自动弹出QQ对话框代码