views:

390

answers:

2

We have several pages of our site indexed using old non-SEO friendly URLS such as http://www.domain.com/DocumentDetails.aspx?id=555. Recently we implemented routing that uses slugs stored in the database and looks up the slug to forward you to the right page using routing, for example: http://www.domain.com/Documents/Title-of-the-Document

This is all well and good however we are having a hard time finding the best way to set up our 301 permanent redirects for all the links currently indexed by Google.

Is there a way to have 1 centralized place to store old URL and new URL, and have it do the 301 redirect automatically when it finds an entry, and also treat different query string parameters as different entries? We are using IIS6 and Server 2003.

Thanks!

+2  A: 

Add a CustomRouteHandler for your old page that can do the 301 to your new URL:

//look up new url and do the 301
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.example.com/");
rick schott
+1  A: 

I have been researching for a similar solution. I found the following:

Redirecting URLs with C#/ASP.NET

I hope that helps!

KTate