我有一个重写规则如下,它工作:
I have a rewrite rule as following,it is working:
RewriteRule area/(.*) listing.php?area=$1
但是,当我想用 29%在里面,但是当我把它改写如下,我得到404错误:
But when I want to use %29 in it,but when I rewrite it as following, I get 404 error:
RewriteRule area/something%29/(.*)/ listing.php?area=$1
逃逸 29%为 \%29 也不能工作。
推荐答案阿帕奇%-de codeS尝试应用重写规则之前的URL路径。所以,你不应该使用%编码在你的重写规则。只需使用普通字符。
Apache %-decodes the url-path before trying to apply the rewrite rules. So you should not use %-encoding in your RewriteRule. Just use the normal character.
所以,你的情况,你应该只使用了)。 )不过是普通的前pression特殊字符,所以你应该在前面加上一个反斜杠那些在正则表达式的方式。因此,这将成为 \)。
So in your case you should just use the ). ) however is a special character in regular expression, so you should escape those in the RegEx way by adding a slash in front. So it will become \).
上面你的规则应该成为:
Your rule above should become:
RewriteRule area/something\)/(.*)/ listing.php?area=$1更多推荐
编码URL中的特殊字符使用htaccess的重写
发布评论