Search Engine Friendly Redirect

Posted Monday, March 26, 2007 10:40 AM by C-Dog's .NET Tip of the Day

Some of you may remember this from some time back but I thought I would post it again since I needed it recently. Response.Redirect out of the box is not very search engine friendly. This is especially the case when you have it on your home page. This is because of the HTTP status code that method uses to do a redirect. To make the search engines complain less, the proper way to do a redirect in this situation is to use a 301 status code and add a Location header to the Response object.

Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", targetUrl);

That is all there is to it. This would be a useful place to add an extension method to the Response object to encapsulate this logic.

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=343