whadiz.com: What is?
Search Articles:     Home | About | Tools | Contact Us
Games
Board Games
Online Games
Databases
Sql Server
Programming
Visual C# in ASP.Net
JavaScript
Humor
Satire
Web Design
Html

Clever Facts Section

What is 301 page move? | Programmatic 301 Moved Permanently | Redirecting traffic when moving pages or changing url

What is 301 page move?

The 301 status code is a status code used to indicate that a webpage has been moved from one url to another. The 301 status code is used to indicate that a page has "moved permanently". 301 Moved Permanently is the correct way of redirecting a user if a website's domain name has changed or if a webpage's url has renamed or moved. 

How do I implement "301 Moved Permanently" programmatically in C#?

Place the following C# code in the Page_Load of the old page, i.e. in the page that has moved to the new url:

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

Replace "www.newurl.com/page.aspx" with the url of the new page, i.e. the url of where the page has moved to. Thus, the old page would still exist, but would be directing traffic towards the new page.

As an example, the page "http://www.whadiz.com/oldpage.aspx" has been renamed to "http://www.whadiz.com/newpage.aspx". To keep al traffic directed at "http://www.whadiz.com/oldpage.aspx", we place a "301 moved permanently" on this page's Page_Load event:

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

When should I use the "301 Moved Permanently" status code?

When moving a website from one domain name to another, or renaming a webpage, those pages might have been indexed by search engines or direct links to those pages might exist. Importent traffic would get lost if you merely rename page.

Direct traffic to pages that have been renamed need to be funneled to the correct pages. "301 Moved Permanently" is a good way of achieving this. "301 Moved Permanently" indicates to search engines that a specific url is now longer applicable and that they should rather index the new url.

"301 Moved Permanently" is also importent to transfer pagerank from the old url to the new url when optimizing for Google.

What other ways of implementing "301 Moved Permanently" exist?

"301 Moved Permanently" can be implemented directly in IIS via settings, or in Apache via an .htaccess file. The programmatic approach is useful when renaming pages, but other approaches should be considered when moving whole websites from one domain name to another.

Link to this article:

Browse some more: Next Article | Next Fact | More Visual C# in ASP.Net Articles | More Clever Facts


Copyright © 2023 whadiz.com. All rights reserved.
whadiz.com: What is 301 page move? | Programmatic 301 Moved Permanently | Redirecting traffic when moving pages or changing url
Home of the answer "what is"