原本的tag链接类似于:
http://www.zzblo.com/tags.php?/织梦/
http://www.zzblo.com/tags.php?/MySQL/
但是从seo的角度来看,我希望 吧链接修改为
http://www.zzblo.com/tags/MySQL/
http://www.zzblo.com/tags/织梦/ 。
修改了两个文件:
【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;