Ever wondered how to automatically redirect from one URL to another - and to do this without getting penalized by the search engine. Well, it's pretty easy - read on for an explanation and code example...
First of all, always use the "301 Moved Permanently" feature to redirect a page from the old location to the new. Otherwise, you may experience a huge downward leap in search engine rankings, 302 hijacking penalties, or other penalties from the search engine. Do not use JavaScript or client-side redirects as these often will be misinterpreted by search engines and cause penalties.
The most common use for the 301 redirect, which all site owners need these days, is the redirect from the "non-www" version of the site's
URL to the "www" one (for example, http://mydomain.com/ to http://www.mydomain.com/). This helps prevent the 302 hijacking.
Insert the code below into your Global.asax, and you are all set :)