I would like to redirect all pages from the website from abc.com/staging/ to the root folder of another domain xyz.com/
For example abc.com/staging/about.html should be redirected to xyz.com/about.html
I tried this, but it doesn't work:
<rule name="testredirect" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^abc/staging" />
</conditions>
<action type="Redirect" url="xyz.com/" redirectType="Permanent" />
</rule>
I think you need to check both
{HTTP_HOST}and{PATH_INFO}. The somewhat tricky thing you are trying to do here is remove/stagingfrom the path. I tried using a "capture"{C:1}to handle this, but it is untested.