Tuesday, March 3, 2009

How to tell search engine the page has moved using 301 permanent redirect asp.net c#?

Many a times you have a situation where you have to rename your page or move your page to a new location.In short URL for that page is change.we can tell search engine that this page is redirected to a newer location using 301 status.

HttpContext context = HttpContext.Current;
if(url=="Your Old URL")
context.Response.Status = "301 Moved Permanently";
context.Response.AddHeader("Location", strUrl );
context.Response.End();
endif

No comments:

Post a Comment