分享:常见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
- 兼容移动和PC的loading加载和toast消息插件 全球[VPS测评]
- 深圳市城市交通规划设计研究中心股份有限公司关于与腾讯云计算(北京)有限责 全球[VPS测评]
- 云计算竞争日趋白热化云计算行业市场前景分析 全球[VPS测评]
- UCloud香港云主机怎么样?UCloud香港云主机1核1G1M评测 香港VPS[主机]
- 九零云怎么样?香港将军澳VPS,美国圣何塞VPS 2核1G10M 47/ 美国VPS[主机]
- 磐逸云怎么样?1核1G香港安畅CN2 VPS带宽5M年付128元 香港VPS[主机]
- 野草云服务器怎么样?香港CN2+BGP带宽30M月付19元 香港VPS[主机]
- 印象云,香港安畅CN2VPS终身8折1核1G22元/月,美国CN2高防V 美国VPS[主机]
- kvmla,新加坡VPS、香港VPS、日本VPS,2核2G云主机仅425 日本VPS[主机]
- 辰迅云怎么样?国内香港云服务器全场5折,物理服务器限时特价 香港VPS[主机]
- 2020年国外VPS哪个最好?教你学会选择国外VPS 全球[VPS测评]
- SugarHosts:虚拟主机三折起,VPS五折起,续费也可以享受优惠 全球[VPS测评]
- 雪花云怎么样?雪花云香港云服务器1核1G2M仅19元/月 香港VPS[主机]
- 瓜云互联:香港CN2/美国洛杉矶高防vps优惠促销,预充款最高送300元 美国VPS[主机]
- 腾讯云香港服务器价格,腾讯云香港云主机多少钱一年? 香港VPS[主机]
- 野草云:2021开年大促 – 香港VPS 136.8元年起;香港服务器3 香港VPS[主机]
- TmhHost:1核/1G/40G SSD/3Mbps/香港三网CN2 香港VPS[主机]
- TmhHost:香港大带宽云服务器/季付8折/200带宽,120元/3月 香港VPS[主机]
- locvps:香港云地多线路BGP云服务器,三网直连,6折终身优惠中,稳 香港VPS[主机]
- 吸血鬼崛起服务器怎么快速搭建? 全球[VPS测评]
- 创意加载进度HTML动画特效,SVG+CSS3实现的动画死神来了load 全球[VPS测评]
- 如何更改WHMCS默认后台路径让WHMCS系统更安全 全球[VPS测评]
- 云计算到底是谁发明的? 全球[VPS测评]
- tudcloud,香港沙田大带宽vps特惠7折,CN2+BGP直连,10 香港VPS[主机]
- 乐趣云怎么样?香港美国云服务器首月8.8元,新增IP5元/个 美国VPS[主机]
- 青果云怎么样?美国/香港/日本云主机 买多久送多久 日本VPS[主机]
- wikihost,微基主机:1核/1G/15G/100Mbps/香港vp 香港VPS[主机]
- 众创逸云:国庆中秋节大促销优惠,不限流量香港CN2线路VPS 5.9元/ 香港VPS[主机]
- 宝塔面板在香港服务器安装启动不了nginx怎么办? 香港VPS[主机]
- 磐逸云:全场8折优惠,1核1G香港套餐月付24元,日本NNT线路套餐,月 日本VPS[主机]
转载请注明原文地址: http://140.238.13.167:12355/read-77691.html











