Dedecms织梦tag链接伪静态的设置
原本的tag链接类似于:
?/织梦/
?/MySQL/
但是从seo的角度来看,我希望 吧链接修改为
织梦/ 。
修改了两个文件:
【1】 、/include/taglib/tag.lib.php
大概在87行将
$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";
修改为
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword'])."/";
【2】、/include/arc.taglist.class.php
大概在457行将
$purl = $this->GetCurUrl();
$purl .= "?/".urlencode($this->Tag);
将修改为:
$purl = "/tags/".urlencode($this->Tag);
apache主机:
RewriteRule ^tags\.html$ tags\.php
RewriteRule ^tags/(.*)/$ tags.php?/$1
RewriteRule ^tags/(.*)/([0-9]+)/$ tags.php?/$1/$2/
Nginx主机:
rewrite "^/tags\.html$" /tags\.php last;
rewrite "^/tags/(.*)/$" /tags.php?/$1/ last;
rewrite "^/tags/(.*)/([0-9]+)/$" /tags.php?/$1/$2/ last;