dedecms栏目列表页分页URL地址seo优化

如果你相信一件事,就去相信,不用等别人来告诉你行或者不行!早安!你不能改变过去,但你可以改变未来。早安!争气永远比生气漂亮。
织梦dedecms 的栏目列表分页链接,仔细观察会发现,在栏目的首页会存在两个内容相同的2个不同url:
一个是在其他页面链接的栏目首页url是www.xxx.com/lanmu1/index.html
另一个是栏目的分页给的链接URL是:www.xxx.com/lanmu1/list_1_1.html
从SEO方面来说,是不太友好的,所以,本文就是针对这个问题,把两个URL统一成index.html
1,找到\include\arc.listview.class.php这个文件,将
$typedir= ereg_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$this->Fields['typedir']);
这段代码添加到"//获得上一页和主页的链接"前面;
2,找到下面几行代码(就在"//获得上一页和主页的链接"下面)
if($this->PageNo != 1)

{

$prepage.="<li><a rel="nofollow noopener noreferrer" href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a></li>\r\n";

$indexpage="<li><a rel="nofollow noopener noreferrer" href='".str_replace("{page}",1,$tnamerule)."'>首页</a></li>\r\n";

}

改成:

if($this->PageNo != 1)

{

if($prepagenum==1)

{

$prepage.="<li><a rel="nofollow noopener noreferrer" href=\&;".$typedir."/\&;>上一页</a></li>\r\n";

}

else

{

$prepage.="<li><a rel="nofollow noopener noreferrer" href=\&;".str_replace("{page}",$prepagenum,$tnamerule)."\&;>上一页</a></li>\r\n";

}

$indexpage="<li><a rel="nofollow noopener noreferrer" href=\&;".$typedir."/\&;>首页</a></li>\r\n";

}
3.找到
$listdd.="<li><a rel="nofollow noopener noreferrer" href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a></li>\r\n";

改成:

if($j==1)

{

$listdd.="<li><a rel="nofollow noopener noreferrer" href=\&;".$typedir."/\&;>".$j."</a></li>\r\n";

}

else

{

$listdd.="<li><a rel="nofollow noopener noreferrer" href=\&;".str_replace("{page}",$j,$tnamerule)."\&;>".$j."</a></li>\r\n";

}
至此,分页url问题解决。

以上就是dedecms栏目列表页分页URL地址seo优化。每天醒来,面朝阳光,嘴角上扬。不羡慕谁,不讨好谁,默默努力,活成自己想要的模样!更多关于dedecms栏目列表页分页URL地址seo优化请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
织梦后台文档列表添加复制文档功能支持所有模型

织梦无法上传ico图标格式文件的如何解决方法

dedecms如何实现任意页面调用当前会员信息的方

织梦dede:tag调用指定多个栏目的TAG标签

织梦栏目列表按附加表自定义字段排序