无法比拟%2F中的mod_rewrite [英] Cannot match %2F in mod_rewrite

查看:165
本文介绍了无法比拟%2F中的mod_rewrite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组重写规则(在的.htaccess)是这样的:

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).

当我在 myserver.com/list/foo%2Cbar 甚至 myserver.com/list/foo/bar ,我得到的结果我想到:list.php的调用与富,酒吧富/条 $ _ GET ['搜索']

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'].

但是,如果我在 myserver.com/list/foo%2Fbar 键入,似乎该规则不匹配!我得到一个404错误信息。有什么可以怎么回事?阿帕奇2.2.14,如果它很重要。

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.

(我试着在Firefox和Chrome,同样的结果 - 但它可能是浏览器出毛病了,当然)。

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

推荐答案

呸,我发现它... Apache的选项<一个href=\"http://httpd.apache.org/docs/2.2/mod/core.html#allowen$c$cdslashes\"><$c$c>AllowEn$c$cdSlashes,不能每个目录或的.htaccess进行设置,这是默认关闭。

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.

这篇关于无法比拟%2F中的mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆