科技常识:LNMP下添加Discuz x2.5的伪静态规则

2021-04-20 09:46:58
导读 今天小编跟大家讲解下有关科技常识:LNMP下添加Discuz x2 5的伪静态规则,相信小伙伴们对这个话题应该也很关注吧,小编也收集到了有关科技

今天小编跟大家讲解下有关科技常识:LNMP下添加Discuz x2.5的伪静态规则,相信小伙伴们对这个话题应该也很关注吧,小编也收集到了有关科技常识:LNMP下添加Discuz x2.5的伪静态规则的相关资料,希望小伙伴会喜欢也能够帮助大家。

打开 LNMP 伪静态文件目录:

复制代码 代码如下:cd /usr/local/nginx/conf

新建并编辑 discuzx25.conf 文件:

复制代码 代码如下:vi discuzx25.conf

按 i 进入编辑模式,添加下面的代码:

复制代码 代码如下: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;}

按 Esc 退出编辑模式,输入 :wq 保存退出。

然后进入网站配置文件目录:复制代码 代码如下:cd /usr/local/nginx/conf/vhost编辑对应的网站配置文件,比如 aaa.com.conf复制代码 代码如下:vi aaa.com.conf找到配置中的复制代码 代码如下:include discuz.conf;修改为复制代码 代码如下:include discuzx25.conf;保存后,重启 Nginx或LNMP:复制代码 代码如下:lnmp restart注:以上是 lnmp 1.2 下的操作。

来源:爱蒂网

免责声明:本文由用户上传,如有侵权请联系删除!

猜你喜欢

最新文章