分享:常见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
- 吸血鬼崛起服务器怎么快速搭建? 全球[VPS测评]
- 因搜包耽误员工下班,苹果将支付3050万美元赔款 全球[VPS测评]
- 美国信贷市场的痛苦将不亚于上世纪70年代的通胀时期 美国VPS[主机]
- 从阿里云七代云服务器,谈云计算四大趋势 全球[VPS测评]
- VPS成立BurjeelHoldings 全球[VPS测评]
- Bloggar-移动端友好的新闻博客类HTML5模板 全球[VPS测评]
- 文物、沉船、村落!干旱导致大量遗迹重见天日 2022年干旱还要持续多久? 全球[VPS测评]
- 拼多多回应筹备跨境电商业务:不予置评 全球[VPS测评]
- 播放量破千万,点赞量破百万,你绝对想不到这三款多功能产品居然在TK上卖爆 全球[VPS测评]
- CombCloud,香港沙田CN2VPS测评,2核1G52元/月,安畅C 香港VPS[主机]
- GreenCloudVPS:5折、6折优惠,日本、新加坡、香港等KVM 日本VPS[主机]
- 云米科技:美国CERA三网回程GIA 10Mbps大带宽,年付最低400 美国VPS[主机]
- 彗星云:香港特价vps1核/1G/无限流量/月付仅9元,年付仅75元;国 香港VPS[主机]
- 阳帝云:香港大宽带vps仅15元/月;美国vps200G防御仅28元/月 美国VPS[主机]
- 弘速科技:香港安畅CN2 GIA/弹性云服务器10元/月,2核1GB/2 香港VPS[主机]
- edgeNAT:2021元旦vps促销_全场韩国/美国/香港VPS低至7 韩国VPS[主机]
- 阿里云免备案服务器怎么样?阿里云香港服务器价格多少钱一年? 香港VPS[主机]
- 硅云香港云服务器怎么样?硅云香港vps访问速度快不快? 香港VPS[主机]
- 阿里云香港服务器多少钱一年?香港云服务器租用年付价格表 香港VPS[主机]
- Hostkvm:香港/韩国CN2云服务器 大带宽VPS 2核4G,$7. 韩国VPS[主机]
- TmhHost:美国洛杉矶CN2 GIA高防vps/日本/香港BGP等K 日本VPS[主机]
- 三优云uuuvps:春节促销,香港cn2 vps低至168元/年,多款配 香港VPS[主机]
- 香港站群服务器租用推荐,香港多IP服务器/VPS套餐(站群需求) 站群服务器[IP]
- 水墨云:2021年特惠活动_IPLC专线/海外CN2/香港/日本/韩国/ 日本VPS[主机]
- 腾讯云香港服务器2核4G30M仅804元/年,2412元/3年;国内轻量 香港VPS[主机]
- 免备案服务器对权重和网站排名有影响吗? 全球[VPS测评]
- 阿里云服务器一年价格多少钱?阿里云服务器报价 全球[VPS测评]
- 2022年有哪些顶级托管服务提供商 全球[VPS测评]
- 宝塔面板怎么放行端口?宝塔面板放行端口的方法 全球[VPS测评]
- 极光kvm怎么样,便宜大带宽香港cmi vps/美国gia vps低至1 美国VPS[主机]
转载请注明原文地址: http://140.238.13.167:12355/read-77691.html











