Discuz7.0/UCHome2.0/WordPress Ngnix下伪静态完全兼容
如果web站点根目录先放的是wordpress,bbs目录下放的Discuz7.0,home目录下方的UCHome2.0,以下rewrite或许对你有用
location / { index index.html index.htm index.php; rewrite ^/home/(space|network)\-(.+)\.html$ /home/$1.php?rewrite=$2 last; rewrite ^/home/(space|network)\.html$ /home/$1.php last; rewrite ^/home/([0-9]+)$ /home/space.php?uid=$1 last; rewrite ^/bbs/archiver/((fid|tid)-[\w\-]+\.html)$ /bbs/archiver/index.php?$1 last; rewrite ^/bbs/forum-([0-9]+)-([0-9]+)\.html$ /bbs/forumdisplay.php?fid=$1&page=$2 last; rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /bbs/viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last; rewrite ^/bbs/space-(username|uid)-(.+)\.html$ /bbs/space.php?$1=$2 last; rewrite ^/bbs/tag-(.+)\.html$ /bbs/tag.php?name=$1 last; if (!-e $request_filename) { rewrite ^.+/?(/wp-.*) $1 last; rewrite ^.+/?(/.*\.php)$ $1 last; rewrite ^(.+)$ /index.php?q=$1 last; } }
顺序也是不能随便的哦。wordpress的伪静态需要放到最下面。