asp处理二级域名
作者:admin 日期:2007-10-31 11:46:18
<%Dim iURL
TheBrowserType=Lcase(Request.ServerVariables("Http_User_Agent"))
broMSIE = "msie"
iURL = Split(Request.ServerVariables("SERVER_NAME"),".")
Response.Write Safereplace(Lcase(iURL(0)))
if Len(Lcase(iURL(0)))<6 or Safereplace(Lcase(iURL(0)))="active" or Safereplace(Lcase(iURL(0)))="apparel" then
sql="Select * From ojuju_Dns Where [Domain]='"&Safereplace(Lcase(iURL(0))) &"'"
Response.Write "<br>"&sql
Set rsDns=CreateObject("ADODB.Recordset")
rsDns.Open sql,conn,1,1
if rsDns.eof then
if Instr(TheBrowserType,broMSIE) <> 0 then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.xxx.com/引导页.asp"
'<如果是ie浏览器,转到这个网址>
else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.xxx.com/真实主页.asp"
'<如果不是ie浏览器,转到这个网址,方便seo>
end if
else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",rsDns("Steering")
'<特别定义的二级域名,用作特殊或保留用途,存放到数据库>
end if
rsDns.close
Set rsDns=nothing
else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.xxx.com/userSpace/User.asp?UserName="&iURL(0)
'<普通的二级域名,留给给用户作为简短域名入口>
end If
ConnClose()%>
上一篇
下一篇
Tags: