- <?php
- $host=$_SERVER['HTTP_HOST'];
- $host=explode(".",$host);
- $count_host=count($host);
- if($count_host==3){
- $host['0'].'.'.$host['2'];
- $ym="http://".$host['0'].".根域名";
- Header("HTTP/1.1 301 Moved Permanently");
- Header("Location: $ym");//你的域名
- }
- if($count_host==2){
- $ym="http://需要跳转的域名";//你的域名
- Header("HTTP/1.1 301 Moved Permanently");
- Header("Location: $ym");
- }
复制代码
|