Tag Archives: permanent redirect

Changing Temporary (302) To Permanent (301) Redirects

It’s common place to register multiple variations of a domain to protect the brand or product that the domain is related to. At some point, a web master must choose what he or she is going to do with the variations, the normal choices are:

  • Do nothing, simply owning them is sufficient
  • Set them up, alias them so the site content is accessible via any of the variations
  • Set them up and redirect the variations to the primary domain

This post is going to discuss the third option, as I have recently seen what I’d consider strange results in that space.

Setting The Scene

Imagine you sell Product A and you have a web site at http://producta.com. For three years http://producta.com has been used as the main web site, however in an exercise for brand consistency – you opt to move the web site to http://brandproducta.com.

The change of domain is handled using a temporary redirect and is successful. Soon after the move, http://producta.com is no longer visible in the search engines and has been replaced with http://brandproducta.com.


As a clean up exercise, I recently went through and updated the redirects on the domain variations (including http://producta.com) to use permanent (301) redirects. At the time, I didn’t think I’d see any changes in the search engine result pages, as http://producta.com hasn’t been in use for quite some time and all that was changing was a temporary (302) redirect into a permanent (301) redirect.

What has happened is that a brand+producta search term which would have returned http://brandproducta.com as the first listing, is now sharing that space with http://producta.com. Since that domain hasn’t been in use for such a long time, Google are using the results from DMOZ for the title and snippet.


I’ve read through the information that Matt Cutts provided when he discussed 302 redirects back in January 2006. There is a lot of good information on that page and also the previously linked article about URL canonicalisation – however nothing that I felt described what I have outlined above.

What I think has happened is that the temporariness of the 302 redirect has kicked in. Google have been seeing the 302 redirect from http://producta.com into http://brandproducta.com for quite some time and have been checking it periodically since it was temporary. When something changed (hence temporary) – Google kicked back into gear and displayed the results from http://producta.com.

Since it is now showing a 301 permanently moved redirect, I suspect that within a short amount of time Google will remove the listing for http://producta.com and it’ll be replaced by http://brandproducta.com.

I’d love to hear from someone if they have a more comprehensive answer on the results I’ve seen.

ASP.NET Permanent (301) Redirect

Within ASP.NET, the System.Web.HttpResponse class providers a method to handle HTTP redirects, aptly named Redirect. The Redirect method has two overloads:

  • Redirect (string)
  • Redirect (string, bool)

The former accepts a string representation of the URI that you’d like to redirect to. The latter accepts the string URI and a boolean indicating whether you want ASP.NET to stop processing the request immediately or to continue throughout the life cycle of the request.

Unless you’re a HTTP junkie or you’ve had a specific reason to issue a permanent redirect (reorganising a web site is a prime candidate), you can be forgiven for not realising that the Redirect method issues a temporary redirect (HTTP 302). Not having needed to issue a permanent redirect through ASP.NET before, I assumed (there is that word again) that there would be additional overloads to handle both temporary (HTTP 302) and permanent (HTTP 301) redirects or optionally another method; I was wrong.

To issue a HTTP 301 permanent redirect through ASP.NET, you need to do a little bit of manual labour; don’t worry it’s only two lines of code:

  • Response.Status = "301 Permanently Moved";
  • Response.AppendHeader ("Location", URI);

At this point, so long as nothing else interferes with the response – the client will receive a standard run of the mill 301 HTTP permanent redirect. If you know or are worried that something following the above lines may modify the response, you can issue an optional Response.End() as the third line to make it take effect immediately.