Multiple redirect to single page in ASP.NET

Posted by Amritha444 under ASP.NET on 3/28/2016 | Points: 10 | Views : 948 | Status : [Member] | Replies : 1
HI All

Please check my rewrite rule pasted below which working in given case . but i need to redirect many urls in a1.mydomain.com to http://www.newdomain.com/brand/static1.html.(mutilple pages to same page)

like this for a1.mydomain.com

i tried by adding one more input
<add input="{HTTP_HOST}" pattern="^a1.mydomain.com?act=order$" />

but its not working . How to do this

<rewrite>
<rules>


<rule name="a1" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^a1.mydomain.com$" />
</conditions>
<action type="Redirect" url="http://www.newdomain.com/brand/static1.html" />
</rule>


<rule name="a2" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^a2.mydomain.com$" />
</conditions>
<action type="Redirect" url="http://www.newdomain.com/brand/static2.html" />
</rule>
</rules>

Thanks in Advance




Responses

Posted by: Bhuvanesh6 on: 7/25/2016 [Member] Starter | Points: 25

Up
0
Down
I believe, multiple redirect is not possible,

The web page will always have the destination URL stored and when multiple redirect is available then the destination URL is overloaded and page will redirect only to the last Redirect page URL.

Have you tried my modifying the match URL section for each rule set?
<match url="(.*)" /> 


Try to have different
<match url="(.*)" />
for each rules.

Bhuvan

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response