开发者

Apache mod_rewrite doesn't match URL containing percent symbol

If the rule:

RewriteRule myurl /newurl

Matches:

http://localhost:8080/test/xxxmyurlyyy

Why doesn't it match this?

http://localhost:8080/test/xxxmyurly%EDyy

EDIT:

I've just discovered utf-8 encoded works just fi开发者_高级运维ne. If I rather use %C3%AD than %ED it's ok. I still need to enable unicode.


It seems to match just fine. Given this:

RewriteEngine On
RewriteLog /tmp/rewrite.log
RewriteLogLevel 5
RewriteRule myurl /stackexchange/foo.html

If I fetch this:

curl http://localhost/test/xxmyurly%EDyy

I see this in /tmp/rewrite.log:

(3) applying pattern 'myurl' to uri '/test/xxxmyurly?yy'
(2) rewrite '/test/xxxmyurly?yy' -> '/serverfault/foo.html'

And I get exactly what I expect (a document with the content "this is a test").

I suspect your problem is other than you think it is. Enable RewriteLog and see what shows up, and then post your results here. Also, seeing more of (ideally, all of) your configuration would help, too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜