月光博客

青青子衿, 悠悠我心, 但为君故, 沉吟至今

« 教你七招,轻松挑选出一款优秀的网站空间Google黑哨 »

多个绑定多域名的ASP代码

  如果只有一个ASP空间,而你又想放置多个多个站点,这些代码可以帮到你。

第一个
<%
if Request.ServerVariables("SERVER_NAME")="www.williamlong.info" then
 response.redirect "williamlong/index.htm"
else
 response.redirect "index2.htm"
end if
%>

 

第二个
<%
select case request.servervariables("http_host")
case "www.williamlong.info" '1
 Server.Transfer("v3.htm")
case "www.williamlong.info" '1
 Server.Transfer("v3.htm")
case "www.moon-soft.com" '2
 Server.Transfer("i.htm")
case "www.write100.com" '3
 Server.Transfer("write100.htm")
...... 继续添加 ......
end select
%>

第三个
<%
if instr(Request.ServerVariables("SERVER_NAME"),"www.williamlong.info")>0 then
 response.redirect "index.asp"
elseif instr(Request.ServerVariables("SERVER_NAME"),"www.moon-soft.com")>0 then
 response.redirect "x/index.asp"
elseif instr(Request.ServerVariables("SERVER_NAME"),"www.write100.com")>0 then
 response.redirect "index3.asp"
end if
%>

第四个
<%
if Request.ServerVariables("SERVER_NAME")="www.williamlong.info" then
 response.redirect "index1.asp"
elseif Request.ServerVariables("SERVER_NAME")="www.moon-soft.com" then
 response.redirect "index2.asp"
elseif Request.ServerVariables("SERVER_NAME")="www.write100.com" then
 response.redirect "index3.asp"
end if
%>

第五个
<%
if Request.ServerVariables("SERVER_NAME")="www.williamlong.info" then
 Server.Transfer("williamlong.htm")
elseif Request.ServerVariables("SERVER_NAME")="www.moon-soft.com" then
 Server.Transfer("moon.htm")
elseif Request.ServerVariables("SERVER_NAME")="www.write100.com" then
 Server.Transfer("write100.htm")
else
 Server.Transfer("other.htm")
end if
%>



原创文章如转载,请注明:转载自月光博客 [ http://www.williamlong.info/ ]

本文链接地址:http://www.williamlong.info/archives/201.html
  • 文章排行:
  • 7.acer
  • 思路不错 :)

    但是这样的话是不是会影响到搜索引擎的收录呢? 好些有些搜索引擎不收录访问域名后直接redirect跳转的网站。
  • 2006-12-26 17:16:58

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

  • 订阅我的博客:订阅我的博客
  • 通过Google订阅本站
  • 通过鲜果订阅本站
  • 通过抓虾订阅本站
  • 通过电子邮件订阅本站

站内搜索


热文排行

最新评论及回复

最近发表

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循“署名-非商业用途-保持一致”的创作共用协议.

This site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.