如何覆盖Tuckey的use-query-string设置?

| 我正在尝试向urlrewrite.xml中的重定向网址添加查询参数:
<rule>
    <condition name=\"host\">www.foo.com</condition>
    <from>^/foo/bar</from>
    <to type=\"redirect\" last=\"true\">http://www.bar.com/foo/bar?test=testString</to>
</rule>
但是进入的请求已经有一个参数,并且结果重定向的URL是这样的: http://www.bar-d.mtvi.com/foo/bar?tes​​t=testString?test2=test2String 注意第二个“?”。 我想要的是:
http://www.bar-d.mtvi.com/foo/bar?test=testString&test2=test2String
在urlrewrite元素中将use-query-string设置为\“ true \”。 问题:如何正确传递查询字符串? 感谢您的考虑和任何建议,不胜感激!     
已邀请:
好的,我知道了。发生这种情况是因为我没有使用\“ $ \”符号关闭\“ from \”匹配项。这是它的外观:
<rule>
    <condition name=\"host\">www.foo-d.com</condition>
    <from>^/foo/bal(\\?)?(.*)?$</from>
    <to type=\"redirect\" last=\"true\">http://www.bar-d.mtvi.com/foo/bar?test=testString&amp;$2</to>
</rule>
唯一的问题是,如果原始请求上没有查询字符串,则\“ to \” stmt仍在查询字符串的末尾添加一个&符。为了克服这个问题,您可以创建2条重写规则,一条与查询字符串匹配,另一条与out匹配。     

要回复问题请先登录注册