欢迎访问 舍力博客(www.shuyong.net)
http://www.shuyong.net/iemlog http://www.shuyong.net/sort/iemlog http://www.shuyong.net/?sort=1以上三种情况URL都是可以打开的,今天的教程就是把这个其中的2个URL301跳转到默认的url上面,教程如下:
<?php $ymurl=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];//获取访问地址 if($sortName){ $emurl=preg_replace('/(http:\/\/|https:\/\/|)*/','',Url::sort($sortid)); if($emurl!=$ymurl&&$page==1){ header('HTTP/1.1 301 Moved Permanently'); header('Location:'.Url::sort($sortid)); }}?>上面代码放入log_list.php文件if(!defined('EMLOG_ROOT')){exit('error!');}的后面即可!!!
$ymurl=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];//获取访问地址 if($sortName){$sorturl=preg_replace('/(http:\/\/|https:\/\/|)*/','',Url::sort($sortid));if($sorturl!=$ymurl&&$page==1){header('HTTP/1.1 301 Moved Permanently');header('Location:'.Url::sort($sortid));}} if($tag){$tagurl=preg_replace('/(http:\/\/|https:\/\/|)*/','',Url::tag($params[2]));if($tagurl!=$ymurl&&$page==1){header('HTTP/1.1 301 Moved Permanently');header('Location:'.Url::tag($params[2]));}} if($record){$recordurl=preg_replace('/(http:\/\/|https:\/\/|)*/','',Url::record($params[2]));if($recordurl!=$ymurl&&$page==1){header('HTTP/1.1 301 Moved Permanently');header('Location:'.Url::record($params[2]));}}
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。