简体   繁体   中英

IIS8 URL Redirect with querystring

This rule doesn't add the querystring to the output and I can't work out why:-

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

The input URL is www.mysite.com/show-week.aspx?siteId=EUR&resortId=672&resortType=1&avail=0

The outupt URL should be www.mysite.com/showresort.aspx?siteId=EUR&resortId=672&resortType=1&avail=0

But what I get is just www.mysite.com/showresort.aspx

You can use trackAllCaptures to capture querystring and then append it to new 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM