tags:

views:

101

answers:

5
  • friendfeed.com uses 302.
  • bit.ly uses 301.

I had decided to use 303.

Do they behave differently in terms of support by browsers ?

A: 

301 is for a permanent redirect and if this is what you want to do then this is recommended by all SEO experts.

dove
+1 for mention of SEO relevance
Richard Ev
No. It isn't. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
David Dorward
I'd say 302 is a temporary redirect, 301 is the permanent one. But I agree it depends on what the poster is trying to achieve.
Steffen
@David and @Steffen both right, the point I was making was about the permanent one not the temporary one. thanks
dove
I'm still not impressed by the claim that snakeoil experts recommend you do what you want to do.
David Dorward
@David i hear you, however as usual it depends on the situation. i had in mind someone moving a site tree or even to a new domain, then it's best to tell whatever bots out there what you mean with the redirect explicitly or indeed if a programmer was consuming a url that had changed, if the code is correct he might know better what to do next.
dove
+1  A: 

Have a look at the HTTP 1.1 Status Code definitions. Different status codes imply different meanings and, therefore, encourage different behavior. Try to use the code which best matches your use case.

Chris R
+2  A: 

Different status codes have different meanings. The HTTP specification describes them: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

301 — moved permanently (and change an

302 — found here

303 — find your response here, but use GET even if you started out with POST

If we take, for example, an Atom feed that has the URL changed for some reason (perhaps it is being moved to Amazon S3 or something). Given a 301 result, the feed reader should note that the feed has moved and update it's subscription. Given a 302, it will get the feed from its new location, but hit the original server looking for the original URI every time it checks for an update. (And a 303 would be silly in this situation).

David Dorward
+2  A: 

Read http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for the answer.

10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

Janek Bogucki
+2  A: 

It depends on your purpose.

301 says “this isn't the proper URL, look elsewhere and use remember that other URL is better; don't come back here!”.

302 says “this is the proper URL which you should carry on using, but to actually get the content look elsewhere”.

303 is like 302 but specifically for redirections after a form submission.

If your purpose is a URL shortener then 303 isn't really relevant. It'll still work, but offers nothing over the normal 302. For a URL shortener I'd say 301 would be most suitable, as the other URL is the ‘real’ one. Saying 302 is trying to keep the ownership of the address and any SEO momentum caused by its use for yourself: a bit rude, but maybe you want to be rude.

bobince
302 meets my requirement perfectly (with Cache-Control: private)
Jacques René Mesrine