1

I am writing a rewrite rule in IIS with type Redirect. I want the new url to have a query string parameter value added newly to it. The old url does not have any query string values.

What is the best way to achieve this?

Old url: abc.com/2017/Sample-Page

New Url: test.abc.com/2017/Sample-Page?redirect=y

<rule name="rewrite with query string" stopProcessing="true">
    <match url="(.*)2017/Sample-Page(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="abc.com" />
    </conditions>
    <action type="Rewrite" url="http://test.abc.com/{R:0}?redirect=y"/>
  </rule>
alicewilliam86
  • 443
  • 1
  • 8
  • 22

1 Answers1

0

This worked:

<rule name="rewrite with query string" stopProcessing="true">
    <match url="(.*)2017/Sample-Page(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="abc.com" />
    </conditions>
    <action type="Rewrite" url="http://test.abc.com/{R:0}?redirect=y"/>
  </rule>
alicewilliam86
  • 443
  • 1
  • 8
  • 22
  • 1
    This is the same rewrite rule that you had in your question. What changed to fix your problem? – bowserm Feb 27 '17 at 22:45