Posted on 22. April 2008 09:16 by B-Virtual
When you run a website, there are times that you'll need to redirect webpages to other webpages. There are two key ways to accomplish this task, issuing a 301 redirect or a 302 redirect. What you might not know is that a 301 redirect is search engine friendly and a 302 redirect is not. 301’s will safely tell the search engines that one page has been permanently moved to a new location, while 302’s tell the search engines that it’s a temporary redirect (which can cause problems down the line.) This shouldn’t be news for anyone working in the search industry, but might be news for website owners outside of the industry.
Since most redirect in ASP.NET are 302's, we need a way to get a 301 redirect in code that is much more SEO friendly. I included a piece of code to show you how this is done.
Add these lines of code to your Page_Load event to get a 301 redirect:
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", http://www.your-new-location.com);
Response.End();
9c66e295-d70f-4e07-bd6f-a5bb144cef04|0|.0
Tags: asp.net, c#