9

I see all tinyurl like sites use 302

But what's the difference?Seems both are working for me

the-wabbit
  • 40,319
  • 13
  • 105
  • 169
vps
  • 1,187
  • 3
  • 12
  • 12

3 Answers3

12

A 301 (moved permanently) status means the resource has been permanently moved to a new location. The client (browser) should use the new location instead of the old one in future.

A 302 (found) status means the resource is temporarily located elsewhere. The client should use the given location for the current request, but in the future should continue to use the old location.

Both status codes will have the effect of having the browser follow a redirect. You should choose to use a 301 or 302 status depending on whether the redirect is permanent or temporary.

More information about these HTTP response codes can be found in RFC 2616.

Phil Ross
  • 7,009
  • 2
  • 23
  • 19
  • What if I want to **cancel** 301?Is that out of control since it's not used again? – vps Feb 06 '10 at 16:53
  • @vps You can cancel the 301 redirect, but there is no guarantee the client will re-request the original URL. If you want to be able to cancel the redirect in the future, then you may be better of using a 302. – Phil Ross Feb 06 '10 at 17:04
3

When a search engine spider founds 301 status code in response header of a webpage, it understand that this webpage is no longer exist, it searches for location header in response pick the new URL and replace the indexed URL with the new one and also transfer pagerank.

So search engine refreshes all indexed URL that is no longer exist (301 found) with the new URL, this will retain your old webpage traffic, pagerank and divert it to the new one (you will not lose you traffic of old webpage).

Browser: if a browser founds 301 status code then it caches the mapping of old URL with the new URL, the client/browser will not attempt to request the original location but use the new location from now on until cache remove.

When search engine spider founds 302 status for a webpage, it will only redirect temporarily to the new location and crawl both of the page,old webpage URL still exists in search engine database and it always attempt to request the old location and crawl it, the client/browser will still attempt to request the original location.

Read more about how to implement it in asp.net c# and how what is the impact in search engine - http://www.dotnetbull.com/2013/08/301-permanent-vs-302-temporary-status-code-aspnet-csharp-Implementation.html

Rohit
  • 131
  • 1
0

They are different in SEO.

For 302 google will save the url of redirector and will point users to it.

Also (for tinyurl) using 302 make it possible to change redirection, e.g. in case of spam (see http://tinyurl.com/nospam.php?id=amgzs6 example). Using 301 makes harder to change the redirection

osgx
  • 583
  • 11
  • 26
  • + http://stackoverflow.com/questions/1393280/http-redirect-301-vs-302-temporary-vs-permanent – osgx Feb 06 '10 at 15:36