分享:常见PHP程序在Nginx环境下的伪静态规则汇总
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

很多时候我们找一些规则可以说“要的时候,怎么找也找不到,不用的时候,天天都随处可见”!这样的情况,想必多数伙伴们遇到过吧!的确这样的情况太多了!对于不同程序的伪静态规则在不同的环境中是有点差别的,今天小七通过收集整理了一下“常见PHP程序在Nginx环境下的伪静态规则”,也方便以后自己使用,毕竟度娘的东西说真的真心的不好用,出来的多数都是一些老掉牙的东西,对于老掉牙的排名还不错,对于一些新的说实在的就是把你脑袋抓破了都没得!
1、WordPress伪静态
复制if (-f $request_filename/index.html){rewrite (.*) $1/index.html break;}if (-f $request_filename/index.php){rewrite (.*) $1/index.php;}if (!-f $request_filename){rewrite (.*) /index.php;}2、PHPCMS伪静态
复制rewrite ^/caipu-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;rewrite ^/content-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 last;rewrite ^/list-([0-9]+)-([0-9]+).html /index.php?m=content&c=index&a=lists&catid=$1&page=$2 last;rewrite ^/tag-([^\.]*)-([0-9]+)-([0-9]+).html /index.php?m=content&c=tag&catid=$2&tag=$1&page=$3 last;rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+).html /index.php?m=comment&c=index&a=init&commentid=content_$1-$2-$3 last;rewrite ^/([^\.]*).html /index.php?m=member&c=index&a=$1 last;3、DEDECMS伪静态
复制rewrite "^/index.html$" /index.php last;rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last;rewrite "^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$" /plus/list.php?tid=$1&totalresult=$2&PageNo=$3 last;rewrite "^/view-([0-9]+)-1\.html$" /plus/view.php?arcID=$1 last;rewrite "^/view-([0-9]+)-([0-9]+)\.html$" /plus/view.php?aid=$1&pageno=$2 last;rewrite "^/tags.html$" /tags.php last;rewrite "^/tag-([0-9]+)-([0-9]+)\.html$" /tags.php?/$1/$2/ last;4、Discuz7伪静态
复制rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;5、DiscuzX伪静态
复制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 ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;if (!-e $request_filename) {return 404;}6、ECSHOP伪静态
复制if (!-e $request_filename){rewrite "^/index\.html" /index.php last;rewrite "^/category$" /index.php last;rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last;rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last;rewrite "^/feed\.xml$" /feed.php last;rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last;rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last;rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last;rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last;rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last;rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last;rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last;rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last;rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last;rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last;rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last;rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last;rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last;rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last;rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last;rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last;rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last;}7、PHPWind伪静态
复制rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;8、SaBlog2.0伪静态
复制# 只带月份的归档rewrite "^/date/([0-9]{6})/?([0-9]+)?/?$" /index.php?action=article&setdate=$1&page=$2 last;# 无分类翻页rewrite ^/page/([0-9]+)?/?$ /index.php?action=article&page=$1 last;# 分类rewrite ^/category/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&cid=$1&page=$2 last;rewrite ^/category/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&curl=$1&page=$2 last;# 归档、高级搜索rewrite ^/(archives|search|article|links)/?$ /index.php?action=$1 last;# 全部评论、标签列表、引用列表 带分页rewrite ^/(comments|tagslist|trackbacks|article)/?([0-9]+)?/?$ /index.php?action=$1&page=$2 last;# tagsrewrite ^/tag/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&item=$1&page=$2 last;# 文章rewrite ^/archives/([0-9]+)/?([0-9]+)?/?$ /index.php?action=show&id=$1&page=$2 last;# RSS rewrite ^/rss/([0-9]+)?/?$ /rss.php?cid=$1 last;rewrite ^/rss/([^/]+)/?$ /rss.php?url=$1 last;# 用户 rewrite ^/uid/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&uid=$1&page=$2 last;rewrite ^/user/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&user=$1&page=$2 last;# 地图文件rewrite sitemap.xml sitemap.php last;# 自定义链接rewrite ^(.*)/([0-9a-zA-Z\-\_]+)/?([0-9]+)?/?$ $1/index.php?action=show&alias=$2&page=$3 last;9、SHOPEX伪静态
复制if (!-e $request_filename) {rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;}10、Typecho伪静态
复制if (-f $request_filename/index.html){rewrite (.*) $1/index.html break;}if (-f $request_filename/index.php){rewrite (.*) $1/index.php;}if (!-f $request_filename){rewrite (.*) /index.php;}以后其他的在随时补充,或者你有一些其他的也可以留言,一起集中在一起!说实在的凭借小七一个人之力实在是太渺小了,如果大家可以互相合作,那也许就是另外一片天地啦!
[Discuz]历史优惠活动内容
猜你可能想看的VPS
- JQuery.validate 通过 class 属性批量设置 inpu全球[VPS测评]
- 补货通知 HostDare→CN2 GIA 线路 VPS 最低$34.4全球[VPS测评]
- 恒创科技→500 元 月-E3 1231v3 16GB 2TB 100M全球[VPS测评]
- 阿里云服务器拼团→低至 1.5 折起 2 核 1G 云服务器低至 148全球[VPS测评]
- 消息 迪拜主机商 hostsailor 近期会接入 CN2 线路 抗投诉全球[VPS测评]
- racknerd 美国高配大流量服务器,美中西部盐湖城,50TB 大流量美国VPS[主机]
- 促销 RackNerd→1 核 CPU 1G 内存 15G SSD 2.全球[VPS测评]
- GbpsCloud→1620 元 月 2GB 内存 30GB 空间 不限虚拟空间(主机)
- CN2 ¥69 月 2 核 CPU 1G 内存 50G 硬盘 2Mbps香港VPS[主机]
- 双十二 CMIVPS→香港沙田直连大陆 VPS 5 折优惠 带宽最高 1香港VPS[主机]
- 搬瓦工补货 $37 年 512M 内存 10G SSD 300G@1Gb全球[VPS测评]
- 企鹅小屋→17.1 元 月 512MB 内存 10GB SSD 空间 3虚拟空间(主机)
- 便宜实惠 腾讯云秒杀→1 核 2G 1M 带宽 ¥88 元每年 2 核 全球[VPS测评]
- ViperHost → 美国 1.4$月付 1C1G15G硬盘 5T流量美国VPS[主机]
- Hostinglotus-月付47元 泰国 1G内存50G硬盘 不限流量全球[VPS测评]
- 跨境电商拔节生长关键期,宁波政协委员月谈会精准助力!全球[VPS测评]
- VPS成立BurjeelHoldings全球[VPS测评]
- WHMCS 8.1如何简化注册页面全球[VPS测评]
- 什么是IconFont ?iconfont 的使用和解析全球[VPS测评]
- 详细介绍vps云服务器及其作用全球[VPS测评]
- 腾讯云秒杀活动:1核/2G/上海&北京,年付99元全球[VPS测评]
- 六一云:香港CN2/洛杉矶高防85折优惠,CDN半年优惠,充值返利送水杯香港VPS[主机]
- 文物、沉船、村落!干旱导致大量遗迹重见天日 2022年干旱还要持续多久?全球[VPS测评]
- 快速云:科普云服务器服务器的概念和作用2022-08-2313:26来源全球[VPS测评]
- 什么是云服务器?云服务器怎么登陆?全球[VPS测评]
- 曾经最大跨境电商平台团队收缩,只剩20人丨GoingGlobal周报全球[VPS测评]
- 如何更改WHMCS默认后台路径让WHMCS系统更安全全球[VPS测评]
- 2023年 IDC市场结构和方向的深度分析全球[VPS测评]
- 亚当云:香港CN2云服务器26元/起_全场低至85折起/续费同价香港VPS[主机]
- 源云主机:圣诞促销香港CN2 GIA VPS年付319元;美国CN2 G美国VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-77691.html











