nginx下35分类目录伪静态怎么设置?35分类目录伪静态规则

nginx下35分类目录伪静态怎么设置?35分类目录伪静态规则

以宝塔为例,依次点击网站——>设置——>伪静态,将以下伪静态规则复制进去后保存即可。

35分类目录nginx伪静态规则:

location / {

rewrite ^/(index|article|webdir|category|update|archives|top|feedback|weblink|rssfeed|sitemap)(/?)$ /index.php?mod=$1 last;

rewrite ^/update/(\d+).html$ /index.php?mod=update&days=$1 last;

rewrite ^/update/(\d+)-(\d+).html$ /index.php?mod=update&days=$1&page=$2 last;

rewrite ^/archives/(\d+).html$ /index.php?mod=archives&date=$1 last;

rewrite ^/archives/(\d+)-(\d+).html$ /index.php?mod=archives&date=$1&page=$2 last;

rewrite ^/webdir/(.*)/(\d+)-1.html$ /index.php?mod=webdir&cid=$2 last;

rewrite ^/webdir/(.*)/(\d+)-(\d+).html$ /index.php?mod=webdir&cid=$2&page=$3 last;

rewrite ^/search/(name|url|tags|intro|pr|br)/(.+)-(\d+).html$ /index.php?mod=search&type=$1&query=$2&page=$3 last;

rewrite ^/search/(name|url|tags|intro|pr|br)/(.+).html$ /index.php?mod=search&type=$1&query=$2 last;

rewrite ^/siteinfo/(\d+).html$ /index.php?mod=siteinfo&wid=$1 last;

rewrite ^/site/(.*)$ /index.php?mod=siteinfo&wid=$1 last;

rewrite ^/artinfo/(\d+).html$ /index.php?mod=artinfo&aid=$1 last;

rewrite ^/linkinfo/(\d+).html$ /index.php?mod=linkinfo&lid=$1 last;

rewrite ^/diypage/(\d+).html$ /index.php?mod=diypage&pid=$1 last;

rewrite ^/rssfeed/(\d+).html$ /index.php?mod=rssfeed&cid=$1 last;

rewrite ^/sitemap.xml$ /index.php?mod=sitemap&cid=0 last;

rewrite ^/article/(.*)/(\d+)-1.html$ /index.php?mod=article&cid=$2 last;

rewrite ^/article/(.*)/(\d+)-(\d+).html$ /index.php?mod=article&cid$2&page=$3 last;

}

伪静态设置完后要在后台系统配置里面的链接设置将网站URL链接结构设置为下图的形式:

35分类目录设置伪静态规则后网站URL链接结构设置图示


Tips:本文仅代表作者观点,不代表本站立场。如侵权,请联系本站删除! 如遇资源链接失效,请联系客服! 未经许可,不得转载。
优优源码基地 » nginx下35分类目录伪静态怎么设置?35分类目录伪静态规则

发表评论

欢迎 访客 发表评论

充会员享特权 整站资源免费下载

充会员享特权——整站资源免费下载!

线上立即开通 联系客服开通