Nginx配置Discuz! x3论坛URL Rewrite 伪静态规则
发布时间:2017-09-02 15:48:38
Nginx配置Discuz! x3论坛URL Rewrite 伪静态规则

Nginx下配置discuz! x3 伪静态,可以按如下三个步骤来实现,本人亲测可用:

步骤1,在nginx配置文件中,添加:

代码示例:

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

步骤2,登录discuz! x3的后台管理,打开SEO设置界面,勾选URL 静态化里边的复选框。
步骤3,重启nginx,使伪静态配置生效:

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:武汉网站优化 http://www.feimao666.com