baobao 发表于 2009-7-17 02:12:04

KT 2003操作系统,域名跳转问题

有两个域名指向KT同一网站,同一空间,一个指向根目录,一个指向二级内目录,问题出来了。。。
我的要求是:
www.nikeexpert.com   指向 /index.html
www.cheap-belt.com   指向 /cheap_wholesale_authentic/Belt_1.html
代码如下一:
<script>   
function   btnClick()   
{   
var   url   =   document.all("url").value;   
var   da   =   "www.nikeexpert.com"   
var   xiao   =   "www.cheap-belt.com"   
if(url==da)   
document.location.href="http://www.nikeexpert.com"   
else   if(url==xiao)   
document.location.href="http://cheap-belt.com/cheap_wholesale_authentic/Belt_1.html"   
else   
return   false;   
return   true;   
}   
</script>   
<input   type=txt   name=url   id=url   value="">   
<input   type=button   value=Enter   OnClick="return   btnClick()">   
代码如下二:
<%   
Domain_Name=Request.ServerVariables("HTTP_HOST")   
Select   Case   Domain_Name   
Case   " www.nikeexpert.com"   Response.Redirect("/index.html")   
Case   " www.cheap-belt.com"   Response.Redirect("/cheap_wholesale_authentic/Belt_1.html")   
Case   Else   Response.Redirect("index.asp")   
End   Select   
%>
参考代码三:
<?php   
switch ($_SERVER["HTTP_HOST"])   
{   
case "asdf.com":   
header("location:index.html");   
break;   
case " www.asdf.com":
header("location:index.html");   
break;   
case "asdf.cn":   
header("location:index_cn.html");   
break;   
case " www.asdf.cn":   
header("location:index_cn.html");   
break;   
}   
?>


ASP
<%   
host=lcase(request.servervariables("HTTP_HOST"))   
'开始条件跳转   
SELECT CASE host   

CASE "blog.it19.cn"   
       response.redirect "/blog/"   
CASE "bbs.it19.cn"   
       response.redirect "/bbs/"   
case "cyle.it19.cn"   
       response.redirect "/cyle/"   
case "www.it19.cn"   
       response.redirect "/cyle/"   
CASE ELSE   
       response.redirect "/main/"   
END SELECT   
%>   


<script>   
function   Getdomain(){   
<!--   
DocURL   =   document.URL;   
   
protocolIndex=DocURL.indexOf("://",4);   
   
serverIndex=DocURL.indexOf("/",protocolIndex   +   3);   
   
BeginURL=DocURL.indexOf("#",1)   +   1;   
   
displayresult=DocURL.substring(protocolIndex   +   3   ,serverIndex);   
   
if   (displayresult=="www.a.com")   
{   
      document.write("www.a.com");   
}   
                  else   if   (displayresult=="www.b.com")   
                  {   
                        document.write("www.b.com");   
                  }   
                  else   if   (displayresult=="www.c.com")   
                  {   
                        document.write("www.c.com");   
                  }   
}   
Getdomain();   
//-->   
</script>
不见效果,请高手们出来看看,郁闷中,特别是那个二层目录的指向好象都不行

cpuer 发表于 2009-7-17 08:48:12

原帖由 baobao 于 2009-7-17 02:12 发表 http://www.hostloc.com/images/common/back.gif
有两个域名指向KT同一网站,同一空间,一个指向根目录,一个指向二级内目录,问题出来了。。。
我的要求是:
www.nikeexpert.com   指向 /index.html
www.cheap-belt.com   指向 /cheap_wholesale_authentic/Belt_1.html
代 ...

这个要求在Linux Aapche下很容易实现,在Windows IIS下我还真不知道怎么弄。

baobao 发表于 2009-7-17 17:53:44

:Q 高手显身...

cpuer 发表于 2009-7-17 18:05:34

原帖由 baobao 于 2009-7-17 17:53 发表 http://www.hostloc.com/images/common/back.gif
:Q 高手显身...

等待IIS高手 :)
页: [1]
查看完整版本: KT 2003操作系统,域名跳转问题