Add the pseudo static rule Discuz x2.5 under LNMP
- 2020-05-10 23:22:09
- OfStack
Open LNMP pseudo-static file directory:
cd /usr/local/nginx/conf
New and edit discuzx25.conf file:
vi discuzx25.conf
Press i to enter edit mode and add the following code:
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;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
return 404;
}
Press Esc to exit edit mode, enter :wq save exit.
Then go to the site profile directory:
cd /usr/local/nginx/conf/vhost
Edit the corresponding website profile, such as aaa.com.conf
vi aaa.com.conf
Find the configuration
include discuz.conf;
Modified to
include discuzx25.conf;
After saving, restart Nginx or LNMP:
lnmp restart
Note: the above is the operation under lnmp 1.2.