<%
name=request.servervariables("HTTP_HOST")
if(name="x.com" or name="www.x.com") then
response.redirect ("http://www.x.com/index.asp")
elseif(name="x.cn" or name="www.x.cn") then
response.redirect ("http://www.x.cn/default1.htm")
elseif(name="x.com.cn" or name="www.x.com.cn") then
response.redirect ("http://www.x.com.cn/default.htm")
elseif(name="x.org" or name="www.x.org") then
response.redirect ("http://www.x.org/2005/")
end if
%>
第一步:创建转向控制页面
创建网站默认的首页文件(通常为"index.ASP"或"default.ASP")如下:
<%
'取得HTTP输入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'开始条件跳转
SELECT CASE host
' 如果HOST的值是
www.abc0.com就选择事件case"www.abc0.com"的命令
CASE "www.abc0.com"
' Below is the redirect command
response.redirect "index_abc0.ASP"
CASE "www.abc1.com"
' Below is the redirect command
response.redirect "index_abc1.ASP"
CASE "www.abc2.com"
' Below is the redirect command
response.redirect "index_abc2.ASP"
' 继续添加...
CASE "www.abcn.com"
' Below is the redirect command
response.redirect "index_abcn.ASP"
'We use CASE ELSE to fix any other requests
CASE ELSE
response.redirect "default.ASP"
END SELECT
%>
第二步:创建相应的被转向文件
创建"index_abc0.ASP"—"index_abcN.ASP",作为各个网站的首页。
第三步:将多个域名的IP地址解析到同一个网站空间
例如:将"www.abc1.com"—"www.abcN.com"的IP地址全部解析到"www.abc1.com"的WEB空间上。
第四步:设置网站的WEB服务
设置WEB服务的别名为:"www.abc1.com
www.abc2.com www.abc3.com ......
www.abcN.com"(注意:别名之前用一个空格分开)
现在你就可以使用象"http://www.abc1.com"、……、"http://www.abcN.com"这类顶级的网址来访问同一个WEB空间,而得到各不相同的首页面了。