http status codes 3xx
source: https://en.wikipedia.org/wiki/URL_redirection
HTTP status codes 3xx
In the HTTP protocol used by the World Wide Web, a redirect is a response with a status codebeginning with 3 that causes a browser to display a different page. If a client encounters a redirect, it needs to make a number of decisions how to handle the redirect. Different status codes are used by clients to understand the purpose of the redirect, how to handle caching and which request method to use for the subsequent request.
HTTP/1.1 defines several status codes for redirection (RFC 7231):
- 300 multiple choices (e.g. offer different languages)
- 301 moved permanently
- 302 found (originally “temporary redirect” in HTTP/1.0 and popularly used for CGI scripts; superseded by 303 and 307 in HTTP/1.1 but preserved for backward compatibility)
- 303 see other (forces a GET request to the new URL even if original request was POST)
- 307 temporary redirect (provides a new URL for the browser to resubmit a GET or POST request)
- 308 permanent redirect (provides a new URL for the browser to resubmit a GET or POST request)
Redirect status codes and characteristics
HTTP Status Code | HTTP Version | Temporary / Permanent | Cacheable | Request Method Subsequent Request |
---|---|---|---|---|
301 | HTTP/1.0 | Permanent | yes | GET / POST may change |
302 | HTTP/1.0 | Temporary | not by default | GET / POST may change |
303 | HTTP/1.1 | Temporary | never | always GET |
307 | HTTP/1.1 | Temporary | not by default | may not change |
308 | HTTP/1.1 | Permanent | by default | may not change |