{"id":182,"date":"2014-07-25T08:10:14","date_gmt":"2014-07-25T00:10:14","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=182"},"modified":"2014-07-26T18:55:00","modified_gmt":"2014-07-26T10:55:00","slug":"htaccess%e6%ad%a3%e5%88%99%e8%a7%84%e5%88%99","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/182.html","title":{"rendered":".htaccess\u6b63\u5219\u89c4\u5219"},"content":{"rendered":"<p># \u2014\u2014 \u4f4d\u4e8e\u884c\u9996\u65f6\u8868\u793a\u6ce8\u91ca\u3002<br \/>\n[F] \u2014\u2014 Forbidden\uff08\u7981\u6b62\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u8fd4\u56de 403 Forbidden\u9519\u8bef\u7ed9\u7528\u6237\u6d4f\u89c8\u5668<br \/>\n[L] \u2014\u2014 Last rule\uff08\u6700\u540e\u4e00\u6761\u89c4\u5219\uff09: \u544a\u8bc9\u670d\u52a1\u5668\u5728\u672c\u6761\u89c4\u5219\u6267\u884c\u5b8c\u540e\u505c\u6b62\u91cd\u5199URL<br \/>\n[N] \u2014\u2014 Next(\u4e0b\u4e00\u6761\u89c4\u5219): \u544a\u8bc9\u670d\u52a1\u5668\u7ee7\u7eed\u91cd\u5199\uff0c\u6307\u5bfc\u6240\u6709\u91cd\u5199\u6307\u4ee4\u90fd\u6267\u884c\u8fc7<br \/>\n[G] \u2014\u2014 Gone\uff08\u4e22\u5931\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u8fd4\u56de410 GONE(no longer exists)\u9519\u8bef\u6d88\u606f<br \/>\n[P] \u2014\u2014 Proxy\uff08\u4ee3\u7406\uff09: \u544a\u8bc9\u670d\u52a1\u5668\u901a\u8fc7mod_proxy\u6a21\u5757\u5904\u7406\u7528\u6237\u8bf7\u6c42<br \/>\n[C] \u2014\u2014 Chain\uff08\u6346\u7ed1\uff09: \u544a\u8bc9\u670d\u52a1\u5668\u5c06\u5f53\u524d\u7684\u89c4\u5219\u548c\u524d\u9762\u7684\u89c4\u5219\u8fdb\u884c\u6346\u7ed1<br \/>\n[R] \u2014\u2014 Redirect\uff08\u91cd\u5b9a\u5411\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u53d1\u51fa\u91cd\u5b9a\u5411\u6d88\u606f\uff0c\u4ee5\u4fbf\u7528\u6237\u6d4f\u89c8\u5668\u53d1\u51farewritten\/modified\uff08\u91cd\u5199\/\u4fee\u6539\uff09URL\u7684\u8bf7\u6c42<br \/>\n[NC] \u2014\u2014 No Case\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09: \u5bf9\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684URL\u4e0d\u533a\u5206\u5927\u5c0f\u5199<br \/>\n[PT] \u2014\u2014 Pass Through\uff08\u653e\u884c\uff09: \u8ba9mod_rewrite\u6a21\u5757\u5c06\u91cd\u5199\u7684URL\u4f20\u56de\u7ed9Apache\u505a\u8fdb\u4e00\u6b65\u5904\u7406<br \/>\n[OR] \u2014\u2014 Or\uff08\u903b\u8f91\u6216\uff09: \u7528\u903b\u8f91\u201c\u6216\u201d\u5c06\u4e24\u4e2a\u8868\u8fbe\u5f0f\u8fde\u63a5\u5728\u4e00\u8d77\uff0c\u5982\u679c\u7ed3\u679c\u4e3a\u201c\u771f\u201d\uff0c\u5219\u4f1a\u5e94\u7528\u540e\u7ee7\u7684\u76f8\u5173\u89c4\u5219<br \/>\n[NE] \u2014\u2014 No Escape\uff08\u7981\u7528\u8f6c\u4e49\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u5728\u8f93\u51fa\u65f6\u7981\u7528\u8f6c\u4e49\u5b57\u7b26<br \/>\n[NS] \u2014\u2014 No Subrequest\uff08\u7981\u7528\u5b50\u8bf7\u6c42\uff09: \u5982\u679c\u5b58\u5728\u5185\u90e8\u5b50\u8bf7\u6c42\uff0c\u5219\u8df3\u8fc7\u5f53\u524d\u547d\u4ee4<br \/>\n[QSA] \u2014\u2014 Append Query String\uff08\u8ffd\u52a0\u67e5\u8be2\u5b57\u7b26\u4e32\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u5728URL\u672b\u5c3e\u8ffd\u52a0\u67e5\u8be2\u5b57\u7b26\u4e32<br \/>\n[S=x] \u2014\u2014 Skip\uff08\u8df3\u8fc7\uff09: \u5982\u679c\u6ee1\u8db3\u67d0\u6307\u5b9a\u7684\u6761\u4ef6\uff0c\u5219\u8df3\u8fc7\u540e\u9762\u7b2cx\u8c03\u89c4\u5219<br \/>\n[E=variable:value] \u2014\u2014 Environmental Variable\uff08\u73af\u5883\u53d8\u91cf\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u5c06\u503cvalue\u8d4b\u7ed9\u53d8\u91cfvariable<br \/>\n[T=MIME-type] \u2014\u2014 Mime Type\uff08MIME\u7c7b\u578b\uff09: \u58f0\u660e\u76ee\u6807\u8d44\u6e90\u6240\u5c5e\u7684MIME\u7c7b\u578b<br \/>\n[] \u2014\u2014 \u5339\u914d\u4e00\u4e2a\u5b57\u7b26\u96c6\u5408\uff0c\u4f8b\u5982[xyz]\u53ef\u4ee5\u5339\u914dx, y\u6216\u8005z<br \/>\n[]+ \u2014\u2014 \u4f8b\u5982[xyz]+\u4f1a\u4ee5\u4efb\u4f55\u987a\u5e8f\u3001\u6b21\u6570\u5339\u914dx,y,z\u7684\u51fa\u73b0<br \/>\n[^] \u2014\u2014 \u5b57\u7b26^\u8868\u793a\u5b57\u7b26\u96c6\u7684\u8865\u96c6\u3002[^xyz]\u5c06\u5339\u914d\u6ca1\u6709x,y\u6216\u8005z\u7684\u5b57\u7b26\u4e32<br \/>\n[a-z] \u2014\u2014 \u8fde\u5b57\u7b26(-)\u8868\u793a\u5339\u914d\u4ece\u5b57\u6bcda\u5230\u5b57\u6bcdz\u7684\u6240\u6709\u5b57\u7b26\u4e32<br \/>\na{n} \u2014\u2014 \u6307\u5b9a\u5b57\u6bcda\u51fa\u73b0\u7684\u6b21\u6570\u4e3an\u6b21\uff0c\u6ee1\u8db3\u8be5\u6761\u4ef6\u65f6\u5339\u914d\u3002\u4f8b\u5982x{3}\u4ec5\u4e0exxx\u5339\u914d<br \/>\na{n,} \u2014\u2014 \u6307\u5b9a\u5b57\u6bcda\u51fa\u73b0\u7684\u6b21\u6570\u81f3\u5c11\u4e3an\u6b21\uff0c\u4f8b\u5982x{3,}\u53ef\u4ee5\u4e0exxx\u6216\u8005xxxx\u7b49\u5339\u914d<br \/>\na{n,m} \u2014\u2014 \u6307\u5b9aa\u51fa\u73b0\u7684\u6b21\u6570\u81f3\u5c11\u4e3an\u5230m\u6b21\u3002<br \/>\n() \u2014\u2014 \u7528\u4e8e\u5c06\u6b63\u5219\u8868\u8fbe\u5f0f\u5206\u7ec4\uff0c\u6ee1\u8db3\u7b2c\u4e00\u7ec4\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5b57\u7b26\u4e32\u4f1a\u88ab\u5b58\u50a8\u5728\u53d8\u91cf$1\u4e2d\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u5982\u679c\u62ec\u53f7\u4e2d\u7684\u4e0d\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f8b\u5982(perishable)?press \u5c06\u80fd\u591f\u5339\u914d\u6709\u6216\u8005\u6ca1\u6709perishable\u524d\u7f00\u7684press<br \/>\n^ \u2014\u2014 \u4f4d\u4e8e\u884c\u9996\u3002\u6ce8\u610f\uff1a\u548c\u4e2d\u62ec\u53f7\u4e2d\u7684[^]\u610f\u4e49\u4e0d\u540c\u3002<br \/>\n$ \u2014\u2014 \u4f4d\u4e8e\u884c\u672b<br \/>\n? \u2014\u2014 \u4f8b\u5982 monzas? \u4f1a\u5339\u914d monza \u6216\u8005 monzas\uff0c\u800c mon(za)? \u4f1a\u5339\u914d mon \u6216\u8005 monza\u3002\u53c8\u5982 x? \u4f1a\u5339\u914d\u201c\u7a7a\u5b57\u7b26\u201d \u6216\u8005 \u4e00\u4e2ax<br \/>\n! \u2014\u2014 \u903b\u8f91\u975e\u3002\u4f8b\u5982\u201c!string\u201d \u5c06\u4f1a\u5339\u914d\u9664\u4e86\u201cstring\u201d\u4ee5\u5916\u7684\u6240\u6709\u5b57\u7b26\u4e32<br \/>\n. \u2014\u2014 \u8868\u793a\u4efb\u610f\u5b57\u7b26\u4e32<br \/>\n- \u2014\u2014 \u547d\u4ee4Apache\u201c\u4e0d\u8981\u201d\u91cd\u5199URL\uff0c\u4f8b\u5982\u201cxxx.domain.com.* \u2013 [F]\u201d<br \/>\n+ \u2014\u2014 \u5339\u914d\u81f3\u5c11\u4e00\u4e2a\u4efb\u610f\u5b57\u7b26\uff0c\u4f8b\u5982G+\u5339\u914d\u4ee5G\u5f00\u5934\u3001\u5e76\u4e14\u540e\u9762\u81f3\u5c11\u6709\u4e00\u4e2a\u5b57\u7b26\u7684\u5b57\u7b26\u4e32<br \/>\n* \u2014\u2014 \u5339\u914d\u96f6\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\uff0c\u4f8b\u5982\u201c.*\u201d\u5339\u914d\u4efb\u610f\u5b57\u7b26\u4e32<br \/>\n| \u2014\u2014 \u903b\u8f91\u201c\u6216\u201d\uff0c\u4e0e[OR]\u4e0d\u540c\u7684\u662f\uff0c\u5b83\u53ea\u5339\u914d\u5b57\u7b26\u4e32\uff0c\u4f8b\u5982(x|y)\u5339\u914dx\u6216\u8005y<br \/>\n\\ \u2014\u2014 \u8f6c\u4e49\u5b57\u7b26\u3002\u53ef\u4ee5\u8f6c\u4e49\u5de6\u62ec\u53f7( \u5c16\u5b57\u7b26^ \u7f8e\u5143\u7b26\u53f7$ \u611f\u53f9\u53f7! \u70b9. \u661f\u53f7* \u7ba1\u9053\u7b26\u53f7| \u53f3\u62ec\u53f7) \u7b49<br \/>\n\\. \u2014\u2014 \u8f6c\u4e49\u4e3a\u70b9\u5b57\u7b26\uff08\u70b9\u5b57\u7b26\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u5b57\u7b26\uff09<br \/>\n\/* \u2014\u2014 \u96f6\u4e2a\u6216\u591a\u4e2a\u6b63\u659c\u6760<br \/>\n.* \u2014\u2014 \u96f6\u4e2a\u6216\u591a\u4e2a\u4efb\u610f\u5b57\u7b26\uff08\u5373\uff0c\u5339\u914d\u4efb\u610f\u5b57\u7b26\u4e32\uff0c\u5305\u62ec\u7a7a\u5b57\u7b26\uff09<br \/>\n^$ \u2014\u2014 \u5339\u914d\u201c\u7a7a\u5b57\u7b26\u201d\u3001\u201c\u7a7a\u884c\u201d<br \/>\n^.*$ \u2014\u2014 \u5339\u914d\u4efb\u610f\u5b57\u7b26\u4e32\uff08\u4ec5\u9650\u4e00\u884c\uff09<br \/>\n[^\/.] \u2014\u2014 \u5339\u914d\u65e2\u975e\u201c\u6b63\u659c\u6760\u201d\u4e5f\u4e0d\u662f\u201c\u70b9\u201d\u7684\u4efb\u610f\u5b57\u7b26<br \/>\n[^\/.]+ \u2014\u2014 \u5339\u914d\u7b2c\u4e00\u4e2a\u5b57\u7b26\u65e2\u975e\u201c\u6b63\u659c\u6760\u201d\u4e5f\u4e0d\u662f\u201c\u70b9\u201d\uff0c\u540e\u7ee7\u5b57\u7b26\u53ef\u4ee5\u662f\u201c\u6b63\u659c\u6760\u201d\u6216\u8005\u201c\u70b9\u201d\u7684\u5b57\u7b26\u4e32<br \/>\nhttp:\/\/ \u2014\u2014 \u5339\u914d\u201chttp:\/\/\u201d<br \/>\n^domain.* \u2014\u2014 \u5339\u914d\u4ee5\u201cdomain\u201d\u5f00\u59cb\u7684\u5b57\u7b26\u4e32<br \/>\n^domain\\.com$ \u2014\u2014 \u4ec5\u5339\u914d\u201cdomain.com\u201d<br \/>\n-d \u2014\u2014 \u6d4b\u8bd5\u5b57\u7b26\u4e32\u662f\u5426\u662f\u5df2\u5b58\u5728\u7684\u76ee\u5f55<br \/>\n-f \u2014\u2014 \u6d4b\u8bd5\u5b57\u7b26\u4e32\u662f\u5426\u662f\u5df2\u5b58\u5728\u7684\u6587\u4ef6<br \/>\n-s \u2014\u2014 \u6d4b\u8bd5\u5b57\u7b26\u4e32\u6240\u6307\u6587\u4ef6\u662f\u5426\u6709\u201c\u975e\u96f6\u201d\u503c<\/p>\n","protected":false},"excerpt":{"rendered":"<p># \u2014\u2014 \u4f4d\u4e8e\u884c\u9996\u65f6\u8868\u793a\u6ce8\u91ca\u3002 [F] \u2014\u2014 Forbidden\uff08\u7981\u6b62\uff09: \u547d\u4ee4\u670d\u52a1\u5668\u8fd4\u56de 403 Forbi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-Technical_literature","tag-99"],"views":1527,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}