织梦tag伪静态

织梦dedecms的TAG实现伪静态的方法/步骤

一、dede后台基本参数核心设置开启伪静态

二、修改 /include/taglib/tag.lib.php,找到:

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

改成

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

tags.php修改

$tag = trim($_SERVER['QUERY_STRING']);换成

$tag = strtolower(trim($_SERVER['QUERY_STRING']));

到这里,织梦dedecms的程序修改完毕了,接下来我们只需要在对应的主机上添加相对的伪静态规则即可!

nginx环境下伪静态规则:

rewrite ^(.*)/tags\.html $1/tags.php;
rewrite ^(.*)/tags/(.*).html $1/tags.php?/$2;
rewrite ^(.*)/tags/(.*)\/([0-9])(?:(\?.*))\.html* $1/tags.php?\/$1\/$2;

你可能感兴趣的:(dedecms,php,开发语言)