开发者

Replacing %26 by & in query string with mod_rewrite

Have tried countless RewriteRule, including those suggested by previous posts. Unefortunately, none works with m开发者_JAVA技巧y problem. Any help appreciated.


Try this rule:

RewriteCond %{QUERY_STRING} ^(([^%]+|%([013-9a-fA-F][0-9a-fA-F]|2[0-57-9a-fA-F]))*)%26(.*)
RewriteRule ^ %{REQUEST_URI}?%1&%4 [N]


  1. First, add to you vhost config: (adding to .htaccess won't work)

    RewriteMap escape int:escape

  2. Next, replace any occurrence of a variable in question with ${escape:$N}, e.g. replace

    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^([^/]+)$ ?query=$1 [L,QSA]
    with
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^([^/]+)$ ?query=${escape:$1} [L,QSA]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜