asp的来访域名跳转程序,不能实现,帮我看看为什么?

ss2113 2006-01-08 04:58:47
程序的目的:当输入的域名是192.168.1.10/tz1,则跳转到dongfanghotel1/index.asp执行
依次类推,这样可以达到一个空间放多个网站(我是买的空间)
(程序在end if出错)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
if instr(request.ServerVariables("server_name"),"192.168.1.10/tz1")then
response.Redirect"/dongfanghotel1/index.asp"
else if instr(request.ServerVariables("server_name"),"192.168.1.10/tz2")then
response.Redirect"/dongfanghotel2/index.asp"
end if
%>
</body>
</html>
...全文
130 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wanghr100 2006-01-08
  • 打赏
  • 举报
回复
其实,只要在192.168.1.10/tz1
tz1目录下放一个默认内容文档就行了.
一般是default.htm

再通过default.htm转向新的地址.
苍白之月 2006-01-08
  • 打赏
  • 举报
回复
免费空间 自己用ASP做域名转向 想法不错 不过涉及问题很多 包括的你的域名是怎么捆绑的

网上有成熟的代码 自己查 ASP域名转向

SERVER_NAME是提取的服务器主机名

还有一个建议 不要用else if 虽然select case好不到哪里去 至少看着方便
<%
servertype=Request.ServerVariables("SERVER_NAME")
select case servertype
case "1.com"
response.Redirect"/dongfanghotel1/index.asp"
case "2.com"
response.Redirect"/dongfanghotel2/index.asp"
case else
response.write "err"
end select%>
KimSoft 2006-01-08
  • 打赏
  • 举报
回复
else if = elseif

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧