[备忘]LNMP下Discuz x2.5 伪静态规则

今天给一台服务器搬了家,文件及数据全部搬过去后访问正常,后来发现dz的伪静态失效,想起LNMP自带的伪静态规则中没有Discuzx 2.5的规则文件,从原来服务器上CP一份,做个备忘。

LNMP的伪静态文件放置路径:

/usr/local/nginx/conf

进入该目录后,新建一个 discuzx25.conf 文件,里面写入以下内容:

rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;if (!-e $request_filename) {        return 404;}

然后 进入:

cd /usr/local/nginx/conf/vhost

修改相应站点的配置文件,找到其中的:

include discuz.conf;

修改为:

include discuzx25.conf;

重启Nginx或LNMP:

/root/lnmp restart

(完)

[备忘]LNMP下Discuz x2.5 伪静态规则

相关文章:

你感兴趣的文章:

标签云: