The new Google-friendly 301 redirects in 4.0

We are going to take a glance at one of the many new features in 4.0 and expand our redirection repertoire by embracing the 301 redirect. 4.0 is nearing closer and the amount of hype about the new Visual Studio is growing exponentially with the new Beta 2 release I decided to take a chance on it and install it on my home dev computer.

Its currently downloading part 11 of 36 components and in preparation I took a look at the new feature list. One of the first things that caught my eye is the new RedirectPermanent method which has been added to the HttpResponse class.

If you have a catalogue of products - say for example you had a client who's a lawnmower retailer. When the old models are replaced by new ones each year a page on your site might cease to exist. If any external sites (or even internal pages) had taken the time to create links to these pages then you would be presented with an error page the next time that link was clicked.

The more savvy ones out there would probably have used the following code in the old page:


This would have worked as far as the visitor to the page was concerned. In the background however the code issued by the server would be a 302 redirect. This kind of redirect means that it is a temporary redirect.

As far as search engines are concerned you are constantly telling them not to update their internal indexes or pass over existing page rank to this new page.

But the problem is that this isn't a temporary redirect its a permanent one, and for that you will need to issue a permanent 301 redirect.

You have just learned about this at a great time in your life because starting with 4.0 this feature is built into the .net library in the form of RedirectPermanent().

Using the same code above you make the minor change to make it look like this:


We have just looked at the simple update you can make to your change so that you can easily create search engine friendly, permanent 301 redirects on your sites.

Further Reading

kick it on Shout it

No comments :