相信现在大部分用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;
}
}
今天暂时整理这些 以后不定期更新。
乐凝网络怎么样?乐凝网络是一家新兴的云服务器商家,目前主要提供香港CN2 GIA、美国CUVIP、美国CERA、日本东京CN2等云服务器及云挂机宝等服务。乐凝网络提供比同行更多的售后服务,让您在使用过程中更加省心,使用零云服务器,可免费享受超过50项运维服务,1分钟内极速响应,平均20分钟内解决运维问题,助您无忧上云。目前,香港HKBN/美国cera云服务器,低至9.88元/月起,支持24小时无理...
快云科技: 12.12特惠推出全场VPS 7折购 续费同价 年付仅不到五折公司介绍:快云科技是成立于2020年的新进主机商,持有IDC/ICP等证件资质齐全主营产品有:香港弹性云服务器,美国vps和日本vps,香港物理机,国内高防物理机以及美国日本高防物理机产品特色:全配置均20M带宽,架构采用KVM虚拟化技术,全盘SSD硬盘,RAID10阵列, 国内回程三网CN2 GIA,平均延迟50ms以下。...
最近发现一个比较怪异的事情,在访问和登录大部分国外主机商和域名商的时候都需要二次验证。常见的就是需要我们勾选判断是不是真人。以及比如在刚才要访问Namecheap检查前几天送给网友域名的账户域名是否转出的,再次登录网站的时候又需要人机验证。这里有看到"Attention Required"的提示。我们只能手工选择按钮,然后根据验证码进行选择合适的标记。这次我要选择的是船的标识,每次需要选择三个,一...