0
votes

I've recently redesigned our website and moved it to a new domain. I need to do some redirects and I'm having some problems getting it to work properly.

I have over 200 pages I need to redirect and I'd prefer to do it in one rule rather than 200.

Here's an example of one I need to redirect:

www.OldSite.net/store/index.php/store_location

redirected to:

www.NewSite.com/store/page.aspx?code=store

The bolded part of the old .net url is what I'm trying to query and use in the new .com url. I'm having difficulty figuring out how to use wildcards, {R:x}s and {C:x}s in the web.config.

I've been able to get a single redirect to work by using a rule with:

conditions logicalGrouping="MatchAny" trackAllCaptures="false"

add input="{HTTP_HOST}{REQUEST_URI}" pattern="www.OldSite.net/store/index.php/store_location" /

/conditions

action type="Redirect" url="https://www.NewSite.com/store/page.aspx?code=store" redirectType="Permanent"/*

But I was hoping there was an easier way to do it all with one rule instead of 200+.

1

1 Answers

0
votes

Through a bunch of trial and error (mostly error :D) I was finally able to get one rule to do all the redirecting for me. In case this helps anyone else, here is the rule I used:

rule name="redirect rule" stopProcessing="true"

match url="(.)/(.)_" /

conditions logicalGrouping="MatchAny" >trackAllCaptures="false"

add input="{HTTP_HOST}{REQUEST_URI}" pattern="www.OldSite.net/store/index.php/" /

/conditions

action type="Redirect" url="https://www.NewSite.com/store/page.aspx?code={R:2}" redirectType="Permanent" /

/rule