js实现域名判断后跳转到指定网址,也适用于同一虚拟空间放多个网站:

<script>
       try
           {
               if(self.location == "http://apple.baidu.com/")
               {
                   top.location.href = "http://baidu.com/apple/";
               }
               else if(self.location == "http://girl.baidu.com/")
               {
                   top.location.href = "http://baidu.com/girl/";
               }
               else if(self.location == "http://simple.baidu.com/")
               {
                   top.location.href = "http://baidu.com/simple/";
               }
               else {document.write ("错误的访问地址")}
           }
       catch(e){ }
   </script>

 

作者:Alone°李道长ご