织梦tag标签伪静态处理方法

更改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:sql sql="select tag from dede_tagindex where id=~title~"}[field:tag/]{/dede:sql}


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


RewriteEngine On

RewriteBase /

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


如需更改为/tags/1.html,则修改为,以上织梦php就不做说明


RewriteEngine On

RewriteBase /

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

RewriteRule ^tags/ /tags.php        


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