帝国CMS7.5默认伪静态nginx版,升级tagid伪静态规则
2022-07-14 本文已影响0人
一同学习
关于帝国CMS的伪静态很多人不知道该怎么写,帝国CMS由于大多是生成html静态文件,所以建议使用nginx服务器,为了方便,伪静态也自然会使用nginx的版本,帝国CMS7.5 nginx默认规则如下:
参考:https://www.glgxt.cn/post/imperial_cms7-5_default.html
帝国CMS伪静态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;rewrite ^/sitemap.xml /sitemap.php;rewrite ^/sitemap-([0-9]+).xml /sitemap.php?classid=$1;if (!-e $request_filename) {return 404;}
上面是帝国CMS默认的nginx伪静态写法,从帝国CMS7.5起,支持Tagsid功能,也就是以前的tagname改成了tagid,让更喜欢id风格的网友满意了,如果你使用tagid,那么你的伪静态规则需要做以下修改:
rewrite ^([^\.]*)/tags-(.+?)-(.+?)\.html$ $1/e/tags/index.php?tagname=$2&page=$3 last;
改成下面这个样子
rewrite ^([^\.]*)/tags-(.+?)-(.+?)\.html$ $1/e/tags/index.php?tagid=$2&page=$3 last;
最后将修改好的伪静态规则保存到服务器
伪静态规则使用方法
这里以宝塔面板为例子:
-
点击对应站点的设置按钮
-
点击左侧伪静态
-
将伪静态规则复制到右侧