2013-11-14 40 views
1

此规则不查询字符串添加到输出,我不明白为什么: -IIS8 URL重定向与查询字符串

<rule name="Show Week" stopProcessing="true"> 
    <match url="^show-week.aspx(.*)" /> 
    <action type="Redirect" url="showresort.aspx{R:1}" redirectType="Permanent" appendQueryString="true" /> 
</rule> 

输入URL是www.mysite.com/show-week。 ASPX?网站ID = EUR & resortId = 672 & resortType = 1 &无济于事= 0

的outupt URL应www.mysite.com/showresort.aspx?siteId=EUR & resortId = 672 & resortType = 1 &无济于事= 0

但我得到的只是www.mysite.com/showresort.aspx

回答

1

您可以使用trackAllCaptures捕获查询字符串,然后将其附加到新的URL。

<rule name="Show Week" stopProcessing="true"> 
    <match url="^show-week.aspx(.*)" /> 
    <conditions trackAllCaptures="true"> 
    <add input="{QUERY_STRING}" pattern="(.*)" /> 
    </conditions> 
    <action type="Redirect" url="showresort.aspx?{C:1}" redirectType="Permanent" appendQueryString="false"/> 
</rule> 
+0

对不起,不适合我。结果相同。只要没有查询字符串,其他重定向就可以正常工作。 – Craig

+0

启用失败的请求追踪,看看发生了什么......这很奇怪...... http://www.iis.net/learn/extensions/url-rewrite-module/using-failed-request-tracing-to- trace-rewrite-rules – bdoshi

+0

失败的请求追踪只在特定条件下记录并且缺少querystrings不是其中之一:( – Craig

相关问题