Craig
Craig

Reputation: 1794

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

Upvotes: 1

Views: 1033

Answers (1)

bdoshi
bdoshi

Reputation: 1071

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>

Upvotes: 1

Related Questions