Question

I have following rule for 301 redirects:

<rule name="301RedirectsRule" enabled="true" stopProcessing="true">
  <match url=".*" />
    <conditions logicalGrouping="MatchAll">
       <add input="{301Redirects:{URL}}" pattern="(.+)" />
    </conditions>
    <action type="Redirect" url="{C:1}" redirectType="Permanent" />
</rule>

In rewrite map there are rules:

<add key="/di/web/home/Glossary/index.aspx" value="/resources/dental-terminology" />
<add key="/di/web/knowledge-base/article.aspx?id=62" value="/resources/oral-pathology/oral-conditions-and-diseases/periodontal-disease" />

First one works perfectly, but any URL with parameter (like second one) doesn't work.

Was it helpful?

Solution

I'm not entirely up to speed with the IIS rewrite module, but you could try to replace {301Redirects:{URL}} with {301Redirects:{REQUEST_URI}}.

I believe the first one does not contain the query string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top