Apache mod_rewrite規則重寫的標誌說明

一、R[=code](force redirect) 強制外部重定向,強制在替代字符串加上http://thishost[:thisport]/前綴重定向到外部的URL.若是code不指定,將用缺省的302 HTTP狀態碼。api


二、 F(force URL to be forbidden)禁用URL,返回403HTTP狀態碼。app


三、 G(force URL to be gone) 強制URL爲GONE,返回410HTTP狀態碼。this


四、 P(force proxy) 強制使用代理轉發。3d


五、 L(last rule) 代表當前規則是最後一條規則,中止分析之後規則的重寫。代理


六、N(next round) 從新從第一條規則開始運行重寫過程。code

七、C(chained with next rule) 與下一條規則關聯,若是規則匹配則正常處理,該標誌無效,若是不匹配,那麼下面全部關聯的規則都跳過。字符串


八、T=MIME-type(force MIME type) 強制MIME類型。get


九、NS (used only if no internal sub-request) 只用於不是內部子請求。string


十、NC(no case) 不區分大小寫。it


十一、QSA(query string append) 追加請求字符串。


十二、NE(no URI escaping of output) 不在輸出轉義特殊字符。

例如:RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE] 將能正確的將/foo/zoo轉換成/bar?arg=P1=zed

 

1三、 PT(pass through to next handler) 傳遞給下一個處理例如:   RewriteRule ^/abc(.*) /def$1 [PT] # 將會交給/def規則處理   Alias /def /ghi

相關文章
相關標籤/搜索