3

I'm new to redirects and having a hard time getting these to work, I have about 1400 URL's from an old site that need to redirect to a new site, same domain name, but different folders and domain strings. Here's what I have that currently does not work, any help is greatly appreciated.

Thanks

<rule name="Redirect0001" patternSyntax="ExactMatch" stopProcessing="true">
                    <match url="www.sitename.com/index.html/_10_12_Slotted_Screwdriver_Bit_2_long?SCREEN=product_ordering&amp;ScreenID=2464&amp;ProductID=952" />                 
                    <conditions>
                        <add input="{HTTP_HOST}{REQUEST_URI}" pattern="www.sitename.com/index.html/_10_12_Slotted_Screwdriver_Bit_2_long?SCREEN=product_ordering&amp;ScreenID=2464&amp;ProductID=952" />
                    </conditions>
                    <action type="Redirect" url="http://www.sitename.com/items.aspx?category=Screwdriver+Bits%2c+Nutsetters+%26+Holders&amp;id=203" />  
                </rule>
squillman
  • 37,883
  • 12
  • 92
  • 146
user221535
  • 33
  • 1
  • 3

1 Answers1

0

A couple of things.

  1. You only want to match things after the / in the match url
  2. You don't want to include the query string in the match url

So, give this rule a try. It matches beginning with index.html/... and uses the Query String in the match conditions.

<rule name="Redirect0001" patternSyntax="ExactMatch" stopProcessing="true">
    <match url="index.html/_10_12_Slotted_Screwdriver_Bit_2_long" />
    <conditions logicalGrouping="MatchAll">
        <add input="{QUERY_STRING}" pattern="SCREEN=product_ordering&amp;ScreenID=2464&amp;ProductID=952" />
    </conditions>
    <action type="Redirect" url="http://www.mysite.com/items.aspx?category=Screwdriver+Bits%2c+Nutsetters+%26+Holders&amp;id=203" appendQueryString="false" />
</rule>

Adding 1400 of these seems rather tedious, though. I would look to see if there is a way you can break them into query string patterns.

squillman
  • 37,883
  • 12
  • 92
  • 146
  • Thanks so much, this worked perfectly, appreciate the help. – user221535 May 27 '14 at 21:18
  • I was going to ask you that, I did notice that there are a few of the pages that are different URL's but do need to redirect to the same page, what's the way to do that? If I could set those up as 1 rule that would at least cut down on total rules to set up. – user221535 May 28 '14 at 15:26
  • Example: all these redirect to same page.. – user221535 May 28 '14 at 15:32
  • OLD http://www.mysite.com/index.html/_32_New_Gray_Knit_Rags_8_lb_net_wt_carton?SCREEN=product_ordering&ScreenID=3090&ProductID=1063 http://www.mysite.com/index.html/_41_New_White_T_Shirt_Wiping_Rags_22_5_lb_net_wt_carton?SCREEN=product_ordering&ScreenID=3090&ProductID=1061 http://www.mysite.com/index.html/_41_New_White_T_Shirt_Wiping_Rags_8_lb_net_wt_carton?SCREEN=product_ordering&ScreenID=3090&ProductID=1064 http://www.mysite.com/index.html/_45_New_Looped_Knit_Rags_8_lb_net_wt_carton?SCREEN=product_ordering&ScreenID=3090&ProductID=1065 – user221535 May 28 '14 at 15:34
  • NEW http://www.mysite.com/items.aspx?category=Rags&id=86 – user221535 May 28 '14 at 15:34