4

What is the difference between 301 Moved Permanently and 303 See Other status codes?

Both are used for redirects. There is some detailed info on the 303 at https://en.wikipedia.org/wiki/HTTP_303, however the following example is hard to wrap a head around. I wouldn't expect a server to deliver me a real-world person..

303 See Other has been proposed as one way of responding to a request for a URI that identifies a real-world object according to Semantic Web theory (the other being the use of hash URIs).For example, if http://www.example.com/id/alice identifies a person, Alice, then it would be inappropriate for a server to respond to a GET request with 200 OK, as the server could not deliver Alice herself. Instead the server would issue a 303 See Other response which redirected to a separate URI providing a description of the person Alice.

I also assume that permanent vs. temporary is not the only/major difference, as 307 is more suitable do point it out. So, what is a typical application of 303 See Other?

3

Servers can't deliver real objects, but URIs can represent real objects. See What is the difference between a URI and a URL?

The example might be better clarified if you imagine that you published and printed a book containing information that used to be on your website. Now that you published the book, you took that information down off your website. You want to redirect the URL on your website to the book's ISBN URN: urn:isbn:0451450523 Because that isn't a resource that your browser is likely to able to locate and download, you should use a 303 See Other redirect to it.

In general you can use a 303 redirect any time that a resource has been removed but there is a suitable replacement:

  • The format changed, for example from HTML to PDF.
  • You no longer sell blue widgets and you want to redirect to the red widgets page.
  • Data is posted to a URL on your server and you want to redirect to a URL with the results.

A temporary or permanent redirect wouldn't be quite appropriate in any of those cases.

1

303 was intended to be used when a user sends a GET request to a POST url.

In other words, let's say you are POSTING to a URL using a PHP command such as $_POST. A user then tries to visit that URL, but that URL isn't supposed to provide a webpage, it's only used for POST. You can then redirect them away from the POST URL with a 303 to a URL that will deliver a 200 status webpage.

It's highly advised not to use 303 redirects for anything other than POST requests, unless perhaps you really know what you are doing. Google advises using 301 redirects when permanent and 302 redirects when temporary. 303 is so unused that you might as well consider it deprecated unless you really understand its purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.