2013-12-08 66 views
1

我有以下的mod_rewrite規則,它從請求剝離.html擴展名並用尾隨替換它/mod_rewrite的重新編碼的查詢字符串參數

# Handle requests to pages ending with .html 
RewriteCond %{REQUEST_URI} .*.html$ 
RewriteRule (.*).html$ $1/ [R=301,QSA,L] 

我發現,如果我的查詢參數包含空格,已編碼,重定向正在重新編碼。因此,如果最初的請求是「/search-results.html?q=some%20string」,它會被重寫爲「/ search-results /?q = some%2520string」

是否有另一個參數可以給爲了防止這種重新編碼發生mod_rewrite?

+0

http://httpd.apache.org/docs/current/rewrite/flags.html – Sumurai8

+0

請注意,如果你想匹配一個點字面,你應該在你的正則表達式中使用'\ .',而不是''。 。儘管如此,這並不是問題所在。 – Sumurai8

回答

1

使用[NE]標誌來避免重複編碼。