dedecms网站tag标签全部静态化的解决方法

http://nm62.cn/2020-11-18 20:35:47

更改tags.php文件在根目录

找到$tag = FilterSearch(urldecode($tag));

替换为:$tag = urldecode($tag);

更改文件arc.taglist.class.php文件文件所在的路径是include/arc.taglist.class.php

找到$this->TagInfos = $this->dsql->GetOne("Select * From `dede_tagindex` where taglike '{$this->Tag}' ");替换为:

$this->TagInfos = $this->dsql->GetOne("Select * From `dede_tagindex` where id like'{$this->Tag}' ");

更改文件tag.lib.php 文件所在的路径include/taglib/tag.lib.php

找到$row['keyword'] = $row['tag']; 将$row['tag']更改为$row['id']

找到$row['link'] = $cfg_cmsurl."/tags.php?/".$row['keyword']."/";更改为:

$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['id']);

(在阿帕奇环境下)

修改taglist.htm模板

<strong>当前位置:</strong>:<a href="{dede:global.cfg_cmsurl/}/">主页</a> > <a href='tags.php'>TAG标签</a> > {dede:field.title /}

替换为:

<strong>当前位置:</strong><a href="{dede:global.cfg_cmsurl/}/">主页</a> > <a href='/tags/'>TAG标签</a> > {dede:field.title /}

.htaccess文件里增加如下规则:

RewriteEngine On

RewriteBase /

RewriteRule ^tags/(.*)$ /tags.php?/$1

最后在根目录下robots.txt中添加 Disallow: /tags.php 防止搜索引擎重复收录。


在线即时通讯 http://www.easyliao.com/