Welcome

首页 / 网页编程 / ASP / ASP实现多域名同一空间的处理实例

ASP实现多域名同一空间的处理实例2010-01-30以这两个域名为例:

http://www.bianceng.cn/

http://club.bianceng.cn/

假设要把这两个域名都绑在同一个空间上,访问时会跳到不同的目录。不是在IIS设置上实现的,而是通过ASP代码来实现。

Code: 以下是引用片段:

<%
"取得HTTP输入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
‘开始条件跳转
SELECT CASE host
" 如果HOST的值是club.bianceng.cn/就选择事件case"club.bianceng.cn/"的命令
CASE "club.bianceng.cn/"
" Below is the redirect command
response.redirect "club/"
CASE "www.bianceng.cn"
response.redirect "/"
"We use CASE ELSE to fix any other requests
CASE ELSE
response.redirect "/"
END SELECT
%>