php把所有页面都指一个域名301永久转向代码
发布时间:2016-10-27 编辑:jiaochengji.com
教程集为您提供php把所有页面都指一个域名301永久转向代码等资源,欢迎您收藏本站,我们将为您提供最新的php把所有页面都指一个域名301永久转向代码资源
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy3787')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy3787>$sn = strtolower($_server['server_name']?$_server['server_name']:$_server['http_host']);
$query = trim(@$_server['request_uri']);
$sn = str_replace('http://','',strtolower($sn));
$url ='www.jiaochengji.com';
if( $sn !=$url || strpos($query,'index.php'))
{
header( "http/1.1 301 moved permanently" );
header( "location: http://$url" );
}
$query = trim(@$_server['request_uri']);
$sn = str_replace('http://','',strtolower($sn));
$url ='www.jiaochengji.com';
if( $sn !=$url || strpos($query,'index.php'))
{
header( "http/1.1 301 moved permanently" );
header( "location: http://$url" );
}
//带参数
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy1149')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy1149>$url = "http://".$url.$_server["request_uri"];
header("http/1.1 301 moved permanently");
header ("location:http://$url");
您可能感兴趣的文章:
301用法与错误详解
PHP 301跳转的方法详解
301与302重定向的区别有哪些
php把所有页面都指一个域名301永久转向代码
php 301重定向的实现方法
PHP网站301重定向方法举例
PHP 301转向实现代码
PHP实现301永久重定向方法
php 301转向的实现方法分享
php域名301转向程序代码
上一篇:怎样才能删除数组的最后一个元素?
下一篇:php几种采集远程服务器内容代码
[关闭]