2

I have a web server that hosts multiple domains running IIS 8.5. One of those domains is going away and needs to be redirected to the root of another domain on the server. I created the rule below and it works fine as long as there is not path. If there is a path, it appends the path and results in a 404 error. I want to ignore the path and only redirect to www.DomainB.com. I would think path would only be included if I put in http://www.DomainB.com/{R:1} as the redirect url but this doesn't seem to be the case. Where am I going wrong here?

    <rule name="Redirect DomainA.com">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^.*DomainA.com$" />
    </conditions>
    <action type="Redirect" url="http://www.DomainB.com/" redirectType="Found"/>
    </rule>
DubStep
  • 151
  • 10

1 Answers1

1

I figured it out. The above is actually good. It was another rule for DomainB, one set to do a redirect from www to non www, which was causing the issue. It did not have DomainB in the condition, but rather a reg expression that matched any www and that rule does have the {R:1} on it, so the path was actually being appended by that rule after the DomainA.com rule processed. After making that rule DomainB specific, the above Redirect DomainA.com rule worked as is

DubStep
  • 151
  • 10