- 申请了几个域名,可是空间(虚拟主机)只有一个,在网上找到了这段代码,贴上来给大家分享,我的域名有:
- 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
- %>
- 大家可以根据自己的需要灵活运用哦,这样只要你的空间可以绑定多个域名你就可以建多个网站了,很爽吧!
复制代码
|