301 redirect to a new web page (C#, VB and ASP.NET) | Free code
Here you can download free code (C# and VB) to do a 301 redirect from old web pages with URLs that no longer exists to new web pages with new URLs.
If you change the URLs for a website or change the domain for an existing website then it makes sense to do a 301 redirect from old URLs to new URLs so that web pages do not lose their positions in search engines. A 301 redirect means that you tell search engines that a web page has changed its URL permanently and that means that the new URL has the same position as the old URL in search engines.
In this template with free code (C# and VB) to do a 301 redirect have we assumed that there is a table in a database with three columns, an identity column for ID, a unique index column for old URLs and a column with new URLs. Redirects with 301 redirect is done in an 404 page and we have made a setting in our web hosting account so that users are sent to our 404 page when a page not is found.
When a user comes to our 404 page do we capture the URL and divide it into three parts. In the third part of the URL is the information that we use to find the old URL in the table for 301 redirects and we then retrieve the new URL to do a 301 redirect from the old URL to the new URL.
Remember that you in your web hosting account must have made a setting for the correct version of "ASP.NET" on your website (the version listed in the "Web.config" file). We are using Visual Web Developer 2005 (2010) Express Edition for web programming.
01-01-2015 | Created by All-templates.biz
Download 301 redirect to a new web page (C#, VB and ASP.NET) | Free code »
Tags: web code seo seo optimizing