首页 » 开源CMS » Discuz » 正文

discuz门户列表分页伪静态设置教程

DISCUZ门户栏目列表分页URL默认是index.php?page=动态的URL地址,如何修改成伪静态呢?下面保哥教你方法:

编辑器打开source/module/portal/portal_list.php

找到下面这行代码:

$multi =multi($count, $perpage, $page, $cat['caturl'], $cat['maxpages']);

替换成如下代码:

$multi = str_replace("index.php?page=","page-",multi($count, $perpage, $page, $cat['caturl'], $cat['maxpages']));

然后在你的伪静态规则中添加以下规则:

RewriteRule ^(.*)/page-([0-9]+)(\?(.*))*$ $1/index.php?page=$2;

以上是apache的规则,以下是nginx的规则:

rewrite ^([^\.]*)/page-([0-9]+)(\?(.*))*$ $1/index.php?page=$2;

发表评论