当前位置:蛙目录

» 站长资讯 » 资讯文章 » 建站技术

» 文章详细 订阅RssFeed

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

来源:本站原创 浏览:688次 时间:2020-07-16

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

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链接结构设置为下图的形式: