实现无限二级域名的功能必须要有独立服务器,虚机是不行的,另外还需将域名解析指向服务器,并将主机头设为空,以下是ASP写的代码,仅供参考:
<%
from=lcase(trim(Request.ServerVariables("HTTP_HOST")))
if from="www.io365.com" then
response.Write( "<frameset><frame src=""index.htm""></frameset>")
elseif from="io365.com" then
response.Write( "<frameset><frame src=""index.htm""></frameset>")
elseif from="www.io365.com.cn" then
response.Write( "<frameset><frame src=""index.htm""></frameset>")
elseif from="www.io365.net" then
response.Write( "<frameset><frame src=""index.htm""></frameset>")
elseif from="kingbaobao.com" then
response.Write( "<frameset><frame src=""baobao/index.asp""></frameset>")
elseif from="www.kingbaobao.com" then
response.Write( "<frameset><frame src=""baobao/index.asp""></frameset>")
elseif left(from,8)="beijing." then
response.Write( "<frameset><frame src=""BeiJing/index.asp""></frameset>")
elseif left(from,10)="guangdong." then
response.Write( "<frameset><frame src=""GuangDong/index.asp""></frameset>")
elseif left(from,9)="shanghai." then
response.Write( "<frameset><frame src=""ShangHai/index.asp""></frameset>")
else
if Instr(from,".io365.com")>0 then
ufrom=Replace(from,".io365.com","")
else
ufrom=Replace(from,".kingbaobao.com","")
end if
sql="select ID from user where uurl='"&ufrom&"'"
set rsy= Server.CreateObject( "ADODB.recordset" )
rsy.Open sql,conn,1,1
if not rsy.eof then
response.Write( "<frameset><frame src=""baobao/index.asp?hyid="&rsy("ID")&"""></frameset>")
else
response.Write("天天上网提醒您:["&from&"]该域名不能打开,请选择其它地址重试!")
'Response.Redirect "index1.htm"
end if
rsy.close
end if
%> |