代码示例
$the_host = $_server['http_host'];//取得当前域名if(strtolower($the_host) != 'test.com')//把这里的域名换上你想要的{ $uriredirect=$_server['request_uri']; //获取域名后的参数 if(strtolower($uriredirect)=="/index.php")//判断是参数为/index.php就显示为/ { $uriredirect="/"; } header("http/1.1 301 moved permanently");//发出301头部 header("location: http://www.test.com" . $uriredirect);//跳转到你希望的地址格式 exit();}
推荐教程:《phpcms教程》
以上就是phpcms的301如何添加?的详细内容。
