Apache2的重写查询字符串两次逃脱 [英] Apache2 rewrite with query string escaped twice
本文介绍了Apache2的重写查询字符串两次逃脱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个虚拟主机配置文件中使用这个规则会导致双倍的查询参数的转义:
Using this rule in a virtual host configuration file leads to double escaping of the query parameters:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
例如:
http://example.com?f=hello%20world
引出
https://example.com?f=hello%2520world
请注意在%25转义%的标志。为什么会出现这种情况?
Note the "%25" escaping the "%" sign. Why is this happening ?
推荐答案
尝试添加的在重写规则的结尾[东北] (noescape)标签:
Try to add the [NE] (noescape) tag at the end of the rewrite rule:
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NE]
这是因为&放大器;
和
和其他一些默认情况下,在改写的过程中逃出
This happens because &
and ?
and some others are escaped by default in the rewrite process.
这篇关于Apache2的重写查询字符串两次逃脱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文