I have two domains both pointing to the same IIS website
domain1.com/website1
domain2.com/website1
I would like to write a URL Rewrite rule to point
domain1.com/*
to a specific subdomain
domain2.com/subfolder.
I can't figure out the IIS URL rewrite rule to accomplish this. Below is what I have:
<rule name="redirect" enabled="true" >stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain1\.com*$" />
</conditions>
<action type="Redirect" url="https://domain2.com/subfolder" />
</rule>
Try this syntax:
<rule name="redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain1\.com*$" />
</conditions>
<action type="Redirect" url="https://domain2.com/subfolder" />
</rule>
i think there is a typo in your code, there is a ">" before stopProcessing that shouldnt be there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.