聚萤映雪

 找回密码
 立即注册
搜索
查看: 2864|回复: 0

nginx主机下discuz伪静态规则,实测有效

[复制链接]
发表于 2022-7-16 12:34:08 | 显示全部楼层 |阅读模式
最近因为从服务器换到云虚拟主机,发现搬家后伪静态都失效了,也尝试使用后台推荐的当前的Rewrite 规则,也是不行,后面从网上找了很多终于找到nginx下discuz伪静态规则,亲测使用有效,有需要的小伙伴可以参考一下:



1.后台设置
1.png

2.伪静态规则
  1. location / {
  2.             rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  3.             rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  4.             rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  5.             rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  6.             rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  7.             rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  8.             rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  9.             rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/archiver/index.php?action=$2&value=$3 last;
  10.             rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
  11.             index  index.html index.htm index.php;
  12.             #autoindex  on;
复制代码


3.主机信息
2.png

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|聚萤映雪 - iJuing

GMT+8, 2024-9-17 03:13 , Processed in 0.031208 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表