Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Search Engine Web World and 301 redirect

Hi,

When working in a Search engine friendly world, every small detail in your page and programming matter on how you can move your site in top position in the search engine. One of those important matter is how we redirect a page to another page.

 

By default we use response redirect which causes a 302 Redirect. For a search engine 302 redirect means that the document has only been temporarily moved and not permanently, hence the search engine will continue to index that page and show it in search result.

The better option is to use the 301 “moved permanently” redirect for the pages. This helps search engine interpret that the document has been permanently moved to the new location and search engine can easily index the new location as the permanent address.

 

The 301 redirection can be done at both IIS level and at Asp.Net level. Here is how you make a 301 redirect in the IIS.

In internet services manager, right click on the file or folder you wish to redirect. Select the radio titled "a redirection to a URL". Enter the redirection page. Check "The exact url entered above" and the "A permanent redirection for this resource". Click on 'Apply'.


To make a 301 redirection in Asp.Net use the following code


Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.VikramLakhotia.com");
Response.End();

Note do not forget to use Response.End() to stop all the other processing in the page life cycle and make the age redirect there itself.


Vikram

3 Comments

Comments have been disabled for this content.