我有網址與編碼斜槓(%2F
),我不能讓重寫規則正確地抓住這個。htaccess的HOWTO改寫編碼的斜槓的URL
我的網址是:
http://example.com/some-path/description%2Frest-of-description/1101
我已經試過像重寫: -
# is the %2F interpreted as a path separator
RewriteRule ^some-path/(.*)/(.*)/(.*)$ /property/view?ref=$3 [B,R=301,L]
# or is it as an encoded string
RewriteRule ^some-path/(.*)%2F(.*)/(.*)$ /property/view?ref=$3 [B,R=301,L]
# or even double encoded
RewriteRule ^some-path/(.*)%252F(.*)/(.*)$ /villas/$1-$2/$3 [B,R=301,NE,L]
我也嘗試添加QSA
以上。
關於被如此here過類似的問題,但它是IIS和基於.NET
我運行LAMP堆棧
選中此:http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes – Nikhil
@Nikhil你應該添加作爲一個答案(多一點信息)。 – MrWhite
我嘗試添加AllowEncodedSlashes開,虛擬主機和所有請求獲得500 ...阿帕奇2.4 – ChrisB