i have two domains which share a similar link for a content that is /games-for-cats. What i want is redirecting the games-for-cats link to another link for FR website for instance but leaving the games-for-cats link untouched for other domain. I am using IIS and asp.net MVC so i tried doing this in the Web.Config but this isn't working. Below is what i tried to do.
<rules>
<rule name="Redirect rule pl for Redirects">
<match url=".*" />
<conditions>
<add input="{Redirects:{REQUEST_URI}}" pattern="(^(preprod\.test-website\.pl)(.*)$)" />
</conditions>
<action type="Redirect" url="{C:3}" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/games-for-cats" value="/link-to-be-redirected" />
</rewriteMap>
</rewriteMaps>
Can someone guide to what the correct rewrite rule is.
Thanks.
You need to add an additional condition to your rule which will trigger your rule for a specific domain only:
<rule name="Redirect rule pl for Redirects">
<match url=".*" />
<conditions>
<add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
<add input="{HTTP_HOST}" pattern="^preprod\.test-website\.pl$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
</rule>
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.