Ramblings of an IT Consultant

ASP.NET 301 Redirect in VB

In Google, Microsoft, PageRank, SEO on October 22, 2010 at 10:05 am

I have been recently been moving a complete website to a new domain and the client asked what will happen to all of the broken links in Google.  They were quite concerned that their page rank would drop due to the massive changes.  Simple I said a 301 redirect and an update to the sitemap will help.

There is a way you can do this from within the web.config or even java script, but for this site decided to create 301 code in the page init event.

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Response.Status = “301 Moved Permanently”
Response.AddHeader(“Location”, “http://www.gallagherit.co.uk”)
End Sub

I made sure that all of the old pages were redirected to their matching new page and following a quick update of the sitemap to remove the broken links and away we went.  I used XML-Sitemaps.com to generate my sitemaps which is free if your website is less than 500 pages in size.

The good thing about 301 redirects is that it keeps Google happy and we all like to keep Google happy dont we?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: