Apache RewriteRule的標誌一覽

也可請參考下面網址
http://res.phpchina.com/manual/apache/mod/mod_rewrite.html
http://hi.baidu.com/phpzhang/blog/item/50ca004bd343b4f982025c87.html

1) R[=code](force redirect) 強制外部重定向
強制在替代字符串加上http://thishost[:thisport]/前綴重定向到外部的URL.如果code不指定,將用缺省的302 HTTP狀態碼。
2) F(force URL to be forbidden)禁用URL,返回403HTTP狀態碼。
3) G(force URL to be gone) 強制URL爲GONE,返回410HTTP狀態碼。
4) P(force proxy) 強制使用代理轉發。
5) L(last rule) 表明當前規則是最後一條規則,停止分析以後規則的重寫。
6) N(next round) 重新從第一條規則開始運行重寫過程。
7) C(chained with next rule) 與下一條規則關聯
如果規則匹配則正常處理,該標誌無效,如果不匹配,那麼下面所有關聯的規則都跳過。
8) T=MIME-type(force MIME type) 強制MIME類型
9) NS (used only if no internal sub-request) 只用於不是內部子請求
10) NC(no case) 不區分大小寫
11) QSA(query string append) 追加請求字符串
12) NE(no URI escaping of output) 不在輸出轉義特殊字符
例如:RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE] 將能正確的將/foo/zoo轉換成/bar?arg=P1=zed
13) PT(pass through to next handler) 傳遞給下一個處理
例如:
RewriteRule ^/abc(.*) /def$1 [PT] # 將會交給/def規則處理
Alias /def /ghi
14) S=num(skip next rule(s)) 跳過num條規則
15) E=VAR:VAL(set environment variable) 設置環境變量


Apache HTTP Server 版本2.2 中文手冊

http://res.phpchina.com/manual/apache/mod/mod_rewrite.html#rewriterule

-------------------------------------------------------------------------------------------
如何實現如下
http://xxx/x.jpg 或 http://xxx/x.bmp 多種文件擴展名
可以通過負載均衡的方式 自動定向到如下多個地址:
1、http://yyy/x.jpg 或 http://yyy/x.bmp
2、http://zzz/x.jpg 或 http://zzz/x.bmp
以達到負載均衡的目的,構建分佈式圖片文件服務器
[url=http://www.idouye.com/]http://www.idouye.com 愛豆葉資料分享[/url]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章