根据来路分别跳转|根据输入域名跳转不同页面

问题要求:根据来路分别跳转|根据输入域名跳转不同页面
PS:前提是不使用域名解析中的 URL转发!
实例: 某人注册了abc.com 和 123.com,但是只有一个主机,向实现如下操作:
 
访客输入:www.abc.com  访问根目录下  index.html
访客输入:www.123.com  访问根目录下  main.html
 
可在原默认主页代码前加上如下判断语句【语言PHP,我就是在Wordpress的首页文件index.php最前面直接加的】
 
<?php  
//echo   ‘http://’.$_SERVER['SERVER_NAME'].’:’.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];  
$sUrl = $_SERVER['SERVER_NAME'];
if ($sUrl=="www.abc.com")
{
   echo ‘<meta http-equiv="refresh" content="0; url=http://www.abc.com/index.html">’;
}
if ($sUrl=="www.123.com")
{
   echo ‘<meta http-equiv="refresh" content="0; url=http://www.abc.com/main.html">’;
}
?>
可根据自己实际要求来灵活变化语句!
版权所有© HzlzH | 本文采用 BY-NC-SA 进行授权
转载需注明 转自: 《根据来路分别跳转|根据输入域名跳转不同页面

相关文章

{ Leave a Reply ? }

  1. kangzj China Internet Explorer Windows

    好方法,也可以用.htaccess来做

  2. 卢松松 China Mozilla Firefox Windows

    你这个牛,可以给网站进行分流了!

  3. 仁心博客 China Internet Explorer Windows

    学习了……

  4. 一米 China Google Chrome Windows

    这个不错,不过我想怎么对访客和蜘蛛区分呢?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)