发布时间:2025-04-17 17:48:24 作者:佚名 阅读:(18)
最近因为工作需要安装了Discuz论坛,安装完成后在后台设置了规则,但访问时出现问题。排查后发现还需要配置对应的伪静态规则,才能正常使用。尤其是在使用Nginx作为服务器时,正确设置伪静态规则非常关键。下面将为大家介绍在Nginx环境下配置Discuz的伪静态方法,供有类似需求的朋友参考。
location / { 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/archiver/index.php?action=$2&value=$3 last; rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last; index index.html index.htm index.php; #autoindex on; }
以上就是云梦编程为大家介绍的关于nginx下discuz伪静态规则的方法,了解更多相关文章请关注云梦编程网!
© 2023 - 云梦编程网 版权所有 鲁ICP备2021017318号-4