14 Oct 2007一个空间放多个网站
发表多个绑定多域名的ASP代码
如果有有一个ASP空间,而你又想放置多个多个站点,这些代码可以帮到你
第一个
[code]<%if Request.ServerVariables(“SERVER_NAME”)=”bbs.at-blog.com” then response.redirect “bbs” else response.redirect “index2.asp” end if%>[/code]
第二个
[code]<% select case request.servervariables(“http_host”) case “www.at-blog.com” ‘1 Server.Transfer(“tgh.asp”) case “www.jiangnan.net.ru” ‘2 Server.Transfer(“jiangnan.asp”) case “www.2mei.org” ‘3 Server.Transfer(“2mei.asp”) …… 继续添加 …… end select %>[/code]
第三个
[code]<%if instr(Request.ServerVariables (“SERVER_NAME”),”www.at-blog.com”)>0 then
response.redirect “index.asp”
else if instr(Request.ServerVariables
(“SERVER_NAME”),”at-blog.com”)>0 then
response.redirect “BLOG/index.asp”
else if instr(Request.ServerVariables
(“SERVER_NAME”),”bbs.at-blog.com”)>0 then
response.redirect “bbs.asp”
end if
end if
end if%>[/code]
第四个
[code]<%if Request.ServerVariables(“SERVER_NAME”)=”www.at-blog.com” then response.redirect “main1.asp” else if Request.ServerVariables(“SERVER_NAME”)=”at-blog.com” then response.redirect “main1.asp” else if Request.ServerVariables(“SERVER_NAME”)=”www.jiangnan.net.ru” then response.redirect “/web/index.asp” else if Request.ServerVariables(“SERVER_NAME”)=”jiangnan.net.ru” then response.redirect “/web/index.asp” end if end if end if end if%>[/code]
第五个
[code]<% ‘取得HTTP输入的值并付值到HTOST中 host=lcase(request.servervariables(“HTTP_HOST”)) ‘开始条件跳转 Select CASE host ‘ 如果HOST的值是www.at-blog.com就选择事件case”www.at-blog.com”的命令 CASE “www.at-blog.com” ‘ Below is the redirect command response.redirect “web/” CASE “www.jiangnan.net.ru” response.redirect “web1/” ‘We use CASE ELSE to fix any other requests CASE ELSE response.redirect “web1/” END Select %> [/code]
[code] [/code]
[code]
或者
[/code]
Til next time,
Jason at 00:00