asp.netiisquery-stringurl-rewrite-moduleiis-8.5

How can I configure url rewrite to redirect from splash.aspx?page=3 to splash3.aspx?


I have already created a topic about query strings, unfortunately the question was closed and no one answers anymore.

For example, I want to redirect from splash.aspx?page=3 to a simpler url e.g. to splash3.aspx. I unfortunately have no backend code where the query string can respond, so I need an alternative. How can I configure url rewrite?


Solution

  • In your web.config, add the following nodes:

    <rewrite>
      <rule name="Redirect splash page 3" stopProcessing="true">
        <match url="splash\.aspx$" />
        <conditions>
          <add input="{QUERY_STRING}" pattern="page=3" />
        </conditions>
        <action type="Redirect" url="splash3.aspx" redirectType="Temporary" />
      </rule>
    </rewrite>
    

    For more information see https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference