相信现在大部分用Linux VP S的朋友都在使用这个迅速传播的Nginx今天就整理一下最常见的P H P程序的Rewr it e(伪静态规则)。
WordPre s slocation/ {index index.html index.php;if(-f$re que st_filename/inde x.html){rewri te(.*)$1/inde x.html b re ak;
}if(-f$reque st_filename/ind ex.p hp){rewr ite(.*)$1/ind ex.p hp;
}if(!-f$reque st_file name){rewr ite(.*)/inde x.php;
}
}
PHPCMSlocation/ {
###以下为PHP CMS伪静态化rewrite规则rewrite^(.*)s how-([0-9]+)-([0-9]+)\.html$$1/s ho w.php?ite mid=$2&pa ge=$3;rewr i te^(.*)list-([0-9]+)-([0-9]+)\.html$$1/list.php?catid=$2&p age=$3;rewrite^(.*)s how-([0-9]+)\.html$$1/show.php?specia lid=$2;
####以下为P HP W ind伪静态化rewr ite规则rewrite^(.*)-htm-(.*)$$1.php?$2 la st;rewrite^(.*)/s imp le/([a-z0-9\_]+\.html)$ $1/s imp le/inde x.php?$2 la st;
}
EC S HO Pif(!-e$request_filename)
{rewrite "^/ind ex\.html" /inde x.p hp la st;rewrite "^/category$" /index.php last;rewrite "^/fee d-c([0-9]+)\.xml$”/feed.php?c at=$1 last;rewrite“^/fe ed-b([0-9]+)\.xml$”/feed.php?brand=$1 last;rewrite“^/feed\.xml$”/feed.php last;rewr it e“^/c ate gory-([0-9]+)-b([0-9]+)-mi n([0-9]+)-ma x([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.ht ml$”
/catego ry.p hp?id=$1&brand=$2&pric e_min=$3&p rice_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;rewr ite“^/c ate go ry-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-
]*)(.*)\.html$”/cate go ry.php?id=$1&brand=$2&p rice_min=$3&price_max=$4&filte r_at tr=$5 last;
rewr ite“^/c at e go r y-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.ht ml$”
/c ategory.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;rewr ite“^/c ate go ry-([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$”/catego ry.p hp?id=$1&brand=$2 last;rewrite“^/c ategory-([0-9]+)(.*)\.html$”/c atego ry.p hp?id=$1 la st;rewrite“^/goods-([0-9]+)(.*)\.html”/goods.php?id=$1 last;rewr it e“^/artic le_c a t-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$”
/article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;rewrite“^/artic le_cat-([0-9]+)-([0-9]+)(.*)\.html$”/artic le_cat.p hp?id=$1&p age=$2 las t;rewrite“^/artic le_cat-([0-9]+)(.*)\.html$”/artic le_cat.php?id=$1 las t;rewrite“^/artic le-([0-9]+)(.*)\.html$”/artic le.php?id=$1 last;rewr ite“^/bra nd-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-
Z]+)\.html”/brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last;rewr i te“^/bra nd-([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.p hp?id=$1&cat=$2 last;rewrite“^/brand-([0-9]+)(.*)\.html”/b rand.php?i d=$1 la st;rewr ite“^/ta g-(.*)\.html”/s earch.php?keywo rds=$1 las t;rewrite“^/s natc h-([0-9]+)\.html$”/s natc h.php?id=$1 last;rewrite“^/group_b uy-([0-9]+)\.html$”/gro up_buy.p hp?act=view&id=$1 las t;rewrite“^/auction-([0-9]+)\.html$”/auction.php?act=view&id=$1 last;rewrite“^/e xc hange-id([0-9]+)(.*)\.html$”/exc hange.p hp?id=$1&a ct=view la st;rewr it e“^/e xc ha nge-([0-9]+)-min([0-9]+)-ma x([0-9]+)-([0-9]+)-(.+)-([a-zA-
Z]+)(.*)\.html$”/e xc hange.php?c at_id=$1&inte gr a l_min=$2&inte gra l_max=$3&p a ge=$4&s ort=$5&order=$6 la st;rewrite^/exc hange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$”
/exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;rewrite“^/e xc hange-([0-9]+)-([0-9]+)(.*)\.html$”
/exchange.php?cat_id=$1&page=$2 last;rewrite“^/exchange-([0-9]+)(.*)\.html$”/exchange.php?cat_id=$1 last;
}
SHOPEX:locati on/ {if(!-e$request_filename) {rewrite^/(.+\.(html|xml|j so n|htm|php|j sp|asp|shtml))$/ind ex.p hp?$1 last;
}
}
SaBlog2.0 (感谢追寻36[正冰]博客提供)
#只带月份的归档re wr it e "^/d ate/([0-9]{6})/?([0-9]+)?/?$"
/index.php?action=article&setdate=$1&page=$2 last;
#无分类翻页rewrite^/page/([0-9]+)?/?$/index.php?action=article&p age=$1 last;
#分类rewrite^/cate gory/([0-9]+)/?([0-9]+)?/?$/inde x.p hp?acti on=artic le&c id=$1&page=$2last;rew r ite^/c at e gory/([^/]+)/?([0-
9]+)?/?$/index.php?action=article&curl=$1&page=$2 last;
#归档、高级搜索rewrite^/(arc hives|search|artic le|link s)/?$/ind ex.p hp?actio n=$1 la s t;
#全部评论、标签列表、引用列表带分页rewrite^/(comme nts|tags li st|trackbacks|artic l e)/?([0-
9]+)?/?$/index.php?action=$1&page=$2 last;
#ta gs rewrite^/tag/([^/]+)/?([0-9]+)?/?$/index.php?action=article&item=$1&page=$2 last;#文章rewrite^/archive s/([0-9]+)/?([0-9]+)?/?$/index.p hp?action=show&id=$1&page=$2 last;#RSS rewrite^/rss/([0-9]+)?/?$/rss.php?cid=$1 last;rewrite^/rs s/([^/]+)/?$/rss.php?url=$1 last;
#用户rewrite^/uid/([0-9]+)/?([0-9]+)?/?$/index.p hp?ac tio n=artic le&uid=$1&page=$2la st;rewrite^/user/([^/]+)/?([0-9]+)?/?$/index.php?action=article&user=$1&page=$2 last;#地图文件rewrite sitemap.xml sitemap.php last;
#自定义链接rewr ite^(.*)/([0-9 a-zA-Z\-\_]+)/?([0-
9]+)?/?$$1/index.php?action=show&alias=$2&page=$3 last;
Discuz 7rewrite^/arc hiver/((fid|tid)-[\w\-]+\.html)$/arc hiver/inde x.php?$1 la st;rewrite^/forum-([0-9]+)-([0-9]+)\.html$/forumd isp lay.p hp?fi d=$1&pa ge=$2 la st;rewr it e^/thread-([0-9]+)-([0-9]+)-([0-
9]+)\.html$/viewthread.php?tid=$1&extra=p age\%3D$3&page=$2 la st;rewrite^/space-(username|uid)-(.+)\.html$/space.p hp?$1=$2 last;rewrite^/tag-(.+)\.html$/tag.php?name=$1 la st;
Typecholo cation/ {index index.html index.p hp;if(-f$reque st_filename/index.html){rewrite (.*)$1/index.html b reak;
}if(-f$reque st_filename/index.php){rewr ite (.*)$1/inde x.p hp;
}if(!-f$request_filename){rewr ite (.*) /ind ex.p hp;
}
}
今天暂时整理这些 以后不定期更新。
ZJI发布了一款7月份特别促销独立服务器:香港邦联四型,提供65折优惠码,限量30台(每用户限购1台),优惠后每月520元起。ZJI是原来Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月启用新域名ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务。下面列出这款服务器的配置信息。香港邦联四型CPU:2*E5-2...
Megalayer 商家在开始看到有提供香港服务器、香港站群服务器的时候有介绍过,后来就一直没有怎么关注。但是前几天有看到网友使用到他们家的美国独立服务器问其如何的,但是我没有使用过就不好评论,这不前几天也有介绍到Megalayer美国独立服务器。以及我们也有看到商家有提供美国站群服务器和美国大带宽服务器产品,可选30M不限制流量CN2优化线路,以及100M不限制流量国际带宽线路。新年元旦后,Me...
在之前几个月中也有陆续提到两次HostYun主机商,这个商家前身是我们可能有些网友熟悉的主机分享团队的,后来改名称的。目前这个品牌主营低价便宜VPS主机,这次有可以看到推出廉价版本的美国CN2 GIA VPS主机,月费地址15元,适合有需要入门级且需要便宜的用户。第一、廉价版美国CN2 GIA VPS主机方案我们可看到这个类型的VPS目前三网都走CN2 GIA网络,而且是原生IP。根据信息可能后续...