域名泛解析,二级域名转向问题- -完美解决
關于實現商務網站二級域名的應用`!
實現條件:
1、必須有一個頂級域名,而且此域名必須做好泛解析并做好指向。
2、必須有一獨立的web服務器 。泛解析的域名指向該服務器。
3、在web服務器上 建一個空的主機頭名的web站點。
4、做域名轉向
什么是域名泛解析?
?????? 客戶的頂級域名abc.com,之下所設的*.abc.com全部解析到同一個IP地址上去。比如客戶設b.abc.com就會自已自動解析到與abc.com同一個IP地址上去,顯示的是跟abc.com一樣的頁面。
目的是讓用戶可以注冊abc.com為后綴虛擬三級域名系統(也可以稱為免費域名)。
實現:
?????? 進入DNS
?????? 打開要做泛解析的域 (abc.com)
?????? 建立新域 名字為 *
?????? 進入這個域建立一個空主機 只輸入 服務器的IP
????? OK~!
實現了泛解析就表示以后 *.abc.com的訪問都會到 指定的WEB服務器上去,現在要做的就是做域名轉向
<!-- #include file="conn/conn.asp" -->
<%
tURL = Request.ServerVariables("HTTP_HOST")??????? '請求頁面的地址
dURL = left(turl,instr(tURL,".")-1)?????????????????????????????? '二級域名名字
sURL = dURL&"."
sURL = replace(tURL,""&sURL&"","")???????????????????????? '頂級域名,也即abc.com
If dURL="www" or durl="" then
??? Response.Redirect("默認首頁")
??? Response.End()
Else
?? Set rs = conn.execute("select id,username from [register] where username='"&dURL&"'")
?? If?? rs.eof and rs.bof then
?????? response.Redirect("默認首頁")
?????? response.End()
?? Else
??? url= ""?????? '此處url 為二級域名訪問的路徑
???? rs.close
??? Set rs = nothing
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META CONTENT="text/html; CHARSET=UTF-8" HTTP-EQUIV="Content-Type">
<TITLE>測試</TITLE>
</HEAD>
<frameset frameborder="0" framespacing="0" scrolling="no" border="0" marginheight="0" marginwidth="0" rows="0,*">
<frame scrolling="NO" noresize="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" target="main" name="main1" SRC="about:blank">
<frame scrolling="yes" noresize="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" target="main1" name="main1" SRC="<%=url%>">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p></body>
</noframes>
</frameset>
</HTML>
<%
?? end if
?? end if
%>
把上面的代碼存為index.asp放在WEB服務器的默認站點上就好了!
總結
以上是生活随笔為你收集整理的域名泛解析,二级域名转向问题- -完美解决的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 北京市谷歌地球高程DEM等高线下载
- 下一篇: 公司无线WIFI解决方案