帝国CMS 7.5 tags伪静态设置教程

帝国CMS 7.5 官方新增了TAGS支持按TAGID伪静态,格式和tagname格式一样,区别是tagname内容要设置为“tagname=etagid+TAGSID”(/tags-etagid8-0.html),这就意味着以后tags连接可以以 /tags-etagid8-0.html 这种形式来展现,更加有利于SEO优化,具体设置方法如下:

进入帝国CMS 后台,点击:系统 -> 系统设置 -> 伪静态参数设置,找到“TAGS信息列表页”,点击右侧的默认即可,如下图所示:

帝国CMS 7.5 tags伪静态设置教程


帝国CMS 7.5 tags伪静态设置教程

然后需要进入服务器设置伪静态规则,如果是 nginx 服务器,规则如下:

rewrite ^/tags-(.+?)-([0-9]+).html$ /e/tags/index.php?tagname=$1&page=$2 last;

Apache规则:

  • RewriteEngine On
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^tags-(.+?)-(.+?)\.html$ /e/tags/index.php?tagname=$1&page=$2


Nginx环境规则:
rewrite ^([^\.]*)/listinfo-(.+?)-(.+?)\.html$ $1/e/action/ListInfo/index.php?classid=$2&page=$3 last;
rewrite ^([^\.]*)/showinfo-(.+?)-(.+?)-(.+?)\.html$ $1/e/action/ShowInfo.php?classid=$2&id=$3&page=$4 last;
rewrite ^([^\.]*)/infotype-(.+?)-(.+?)\.html$ $1/e/action/InfoType/index.php?ttid=$2&page=$3 last;
rewrite ^([^\.]*)/tags-(.+?)-(.+?)\.html$ $1/e/tags/index.php?tagname=$2&page=$3 last;
rewrite ^([^\.]*)/comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)\.html$  $1/e/pl/index\.php\?doaction=$2&classid=$3&id=$4&page=$5&myorder=$6&tempid=$7 last;
if (!-e $request_filename) {
return 404;
}

设置完成后,我们到管理tags中,点击tag的ID,链接已经变成了“/tags-etagid8-0.html”这种形式了,设置完毕!