您现在的位置: 设计龙 >> 网络编程 >> asp教程 >> 正文

多个域名绑定一个空间的ASP代码

Author:admin Link:www Hits: Update:2006-8-31 20:24:42
天极网摘 ViVi收藏夹 365Key 和讯网摘 POCO网摘

第一步:创建转向控制页面
  创建网站默认的首页文件(通常为"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空间,而得到各不相同的首页面了。

 

   
  • 上一篇文章:
  • 下一篇文章:
  • [回到标题] [回到顶部]