Search code examples
asp.netiis-7web-configwindows-server-2008http-status-code-301

Setting up 301 redirects with Dynamic URLs


I'm guessing this is actually an impossible task, but I thought I'd run it by StackOverflow to see if I'm wrong. Basically we have some dynamically created URLs for SEO purposes (around 300,000+ of them) and we want to do 301 redirects to them.

Our current URLs look like this:

http://www.site.com/<Brand>/<Product Name>/<productGuid>

Our old URLs looked something like this:

http://www.site.com/productpage.aspx?productGUID=<productGuid>

Google still has a load of the old URLs indexed, but we obviously want them to know that they should be replaced with our newer ones (and that it's not just duplicate content), hence the 301 redirects.

Our problem is that the <Brand> and <Product Name> parts of the new URLs are obviously dynamically created... making it impossible to create 301 redirects for them.

Or is it impossible?

Thanks for any ideas or advice on how we might get Google to start updating their indexed URLs to the new ones.


Solution

  • Create a new internal name for your Product page, for example: ProductPageInternal.aspx.

    Rewrite all ProductPage.aspx traffic to a Redirect.aspx page which contains 301 redirect code to the new, nice url.(thekaido's idea)

    Rewrite all new Urls to ProductPageInternal.aspx.

    <rewrite url="~/ProductPage.aspx?GUID=(.+)" to="~/Redirect.aspx?productGUID=$1" /> 
    <rewrite url="~/(.+)/(.+)/(.+)" to="~/productpageInternal.aspx?productGUID=$3" />