开发者

Cannot match %2F in mod_rewrite

开发者 https://www.devze.com 2023-04-08 19:07 出处:网络
I have a set of rewrite rules (in a .htaccess) something like this: RewriteRule ^list/vendor/(.*)$ list.php?vendor=$1

I have a set of rewrite rules (in a .htaccess) something like this:

RewriteRule ^list/vendor/(.*)$ list.php?vendor=$1
RewriteRule ^list/product/(.*)$ list.php?product=$1
RewriteRule ^list/(.*)$ list.php?search=$1

(I don't think the first two are relevant to my question, though).

When I type in myserver.com/list/foo%2Cbar or even myserver.com/list/foo/bar, I get the results I expect: list.php is called with foo,bar and foo/bar in $_GET['search'].

But if I type in myserver.com/list/foo%2Fbar, it seems that the rule doesn't match! I get a 404 error instead. What can be going on here? Apache 2.2开发者_如何转开发.14, if it matters.

(I tried in Firefox and Chrome, same results -- but it could be the browser acting up, of course).


Bah, I found it... Apache option AllowEncodedSlashes, which cannot be set per directory or from .htaccess, and which is Off by default.

Build-a-workaround time, if I can't get the hosting guys to turn it on in my virtual server.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号