Discuz!X Nginx 的伪静态(Rewrite)规则

来自:互联网
时间:2018-08-27
阅读:

Discuz!X是康盛创想(Comsenz)推出的一个以社区为基础的专业建站平台,让论坛(BBS)、个人空间(SNS)、门户(Portal)、群组(Group)、应用开放平台(Open Platform)充分融合于一体,帮助网站实现一站式服务。

把下面代码存为discuzx.conf,然后在域名配置文件(domAIn.com.conf)中嵌入(include discuzx.conf)就行了。

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/index.php?action=$2&value=$3 last; 
    if (!-e $request_filename) { 
        return 404; 
    } 
}
返回顶部
顶部