• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

301 redir pattern using IIS 8

I'm replacing an old website, but want to preserve the Google ranking of the old product pages as much as possible, so need to implement 301 permanent redirects for a few hundred product pages.

Open in new window

The new site is running on IIS 8

The URLs generally follow a pattern. I'm not up to speed on the new rewrite features of IIS 7/8. I believe that there is a way to either implement a pattern using wildcards OR regular expressions.

Can somebody please point me to the best way to do this using IIS 8?

Here's an example of the product pages that need to be rewritten:
OriginalDomain/Widget-Category/Undercover__UNDERCOVER.aspx		NewDomain/gadget-category/undercover
OriginalDomain/Widget-Category/Arrow__ARROW.aspx			NewDomain/gadget-category/arrow
OriginalDomain/Widget-Category/Dodger__DODGER.aspx			NewDomain/gadget-category/dodger
OriginalDomain/Widget-Category/Small-Kona-SET__SMALLKONASET.aspx	NewDomain/gadget-category/small-kona-set
OriginalDomain/Widget-Category/Kona__KONA.aspx				NewDomain/gadget-category/kona

Open in new window

1 Solution
cdakzAuthor Commented:
Forgot to add this this site is running on a remote, shared server, so I don't have access to the IIS MMC Console, which I see can be used to generate rules on-the-fly.

I guess what I'm saying is that I'm looking for a way to do this in a .config file.
Terry WoodsIT GuruCommented:
I noticed this question because I have an alert set up for regular expression related questions... I'm not familiar with IIS, but copying the technique of an example I found elsewhere, I added a suitable pattern and action, so it might work for you:
    <rule name="Redirect VIN">
                    <match url="OriginalDomain/Widget-Category/([^_]*)" />
                    <action type="Rewrite" url="NewDomain/gadget-category/{R:1}" />

Open in new window

In your example the words Undercover, Arrow etc in the original URI have the first letter as upper case. I'm not sure how you might convert that to lower case for the new URI, but perhaps it doesn't matter?

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now