PHP output HTTP status code and common status code

Source: Internet
Author: User
Tags rfc

100-199 is used to specify certain actions that the client should be corresponding.
200-299 is used to indicate a successful understanding and acceptance of the request.
300-399 is used for files that have been moved and is often included in the locator header information to specify the new address information.
400-499 is used to indicate client-side errors.
500-599 is used to support server errors.

[Informational 1xx] Informatization
100= "Continue" continue: If the server receives a request with 100-continue in the header, this means that the client asks whether an attachment can be sent in a subsequent request. In this case, the server uses (Sc_continue) to allow the client to continue or use 417 (expectation Failed) to tell the client that it does not agree to accept the attachment. This status code is newly added to HTTP 1.1.
101= "Switching Protocols" Exchange protocol: The server understands and is willing to comply with customer requirements by upgrading the message header field to change the application protocol used in this connection.

[Successful 2xx] Success
>>>200= "OK" success
201= "Created" creation: The request has been completed, resulting in a new resource being created. Its URL should be given in the anchor header information.
202= "Accepted" accepted: The processing request has been accepted, but the processing has not yet completed.
203= "non-authoritative Information" non-authorized information
>>>204= no content: The server has completed the request, but no content is returned.
205= Reset Content: The server has completed the request and the user agent should reset the document view that caused the request to force the browser to clear the form field. This is the new entry in HTTP 1.1.
206= partial content: Sent when the server completes a partial request containing the range header information

[Redirection 3xx] redirect
300= "multiple Choices" multiple choices: indicates that the requested document can be found in multiple places and will be listed in the returned document. If the server has preferred settings, the preferences will be listed in the location response header information.
>>>301= "Moved permanently" permanent move: The requested resource is assigned a new permanent URI and any future references to this resource should use this returned URI, and the browser will automatically connect to the new URL. Note: When automatically redirecting a POST request to receive a 301 status code, some existing http/1.0 user agents will incorrectly change to a GET request
>>>302= "Found" Discovery: The requested resource temporarily resides in a temporary URI. Similar to 301, just the URL given in the locator header information should be interpreted as a temporary interchange address instead of permanent. Note: In HTTP 1.0, messages are temporarily moved (Moved temporarily) instead of being discovered
303= "See other" view other: The response to the request can be retrieved in a different URI that should use the Get method of that resource. Similar to 301 and 302, only if the initial request is post, then the new document (given in the locator header information) is retrieved with GET. This status code is newly added to HTTP 1.1.
>>>304= "Not Modified" is not modified: If the customer has the condition to perform a GET request, allowing access, but the file has not been modified, the server should respond to this status code.
305= "Use proxy": The location field of the requested resource must be accessed through the proxy. Newly added in HTTP 1.1.
306= "(Unused)" (unused) 306 status code used in the previous version of the specification, no longer used, the code is reserved
307= "Temporary Redirect" temporary redirect: The requested resource temporarily resides in a different URI. The browser handles the 307 status with the same rules as 302. The 307 state is added to HTTP 1.1 because many browsers still perform the wrong turn when receiving a 302 response, even if the original message is post. It is only assumed that the browser will redirect at the post request only when the 303 response is received. The purpose of adding this new status code is clear: When the response is 303, the Get and post requests are turned, while in the 307 response the GET request is turned instead of the POST request.

[Client Error 4xx]
The >>>400= "Bad Request" server does not understand the syntax of the request.
>>>401= "Unauthorized" unauthorized: The request requires user authentication, and if the request already contains an authorization certificate, the 401 response indicates that the credential has been rejected. This response must contain a www-authenticate of the authorization information header.
402= "Payment Required" payment required: This code is reserved for future use.
>>>403= "Forbidden" is forbidden: The server understands the request but refuses to fulfill it.
>>>404= ' not Found ' not found
405= "Method not allowed" is not allowed: The method specified in the request line is a resource that is not allowed to be identified by the request URI. Indicates that the request method (GET, POST, HEAD, PUT, DELETE, etc.) is not allowed for certain specific resources.
406= "not acceptable" is unacceptable: the MIME type representing the requested resource is inconsistent with the type specified in the Accept header information in the client.
407= "Proxies authentication Required" Proxy authentication: This code is similar to 401 (unauthorized), but indicates that the client must first authenticate it.
408= Request Timeout: The client did not produce a request during the time the server was ready to wait. Newly added to HTTP 1.1.
409= "Conflict" conflict: Unable to complete the request because of a conflict with the current state of the resource. This state is typically used with a put request, and the 409 state is often used when attempting to upload an incorrect version of a file. The status code is newly added to HTTP 1.1.
>>>410= "Gone" is missing: The requested resource is no longer an available server, and there is no forwarding address. Tells the client that the requested document is no longer present and does not have an updated address. The 410 status differs from 404,410 in cases where the instruction document has been removed and 404 is used for unknown reasons. The status code is newly added to HTTP 1.1.
411= "Length Required" is required: The server rejects the request without defining the content length. Indicates that the server cannot process the request (assumed to be a POST request with an attachment) unless the client sends the CONTENT-LENGTH header information indicating the size of the data sent to the server. The status is newly added to HTTP 1.1.
412= "Precondition Failed" precondition failed: the precondition given in one or more request header fields when one or more request header field is tested on the server. Indicates that some of the prerequisites in the request header information are incorrect. The status is newly added to HTTP 1.1.
413= "Request entity Too Large" is too large: Tell the client that the requested document is now larger than the server wants to handle now. If the server thinks it can be processed over a period of time, it will contain a retry-after response header information. The status is newly added to HTTP 1.1.
414= "Request-uri Too Long" request URI is too long: The state is used in cases where the URI is too long. The "URI" referred to here refers to the content after the host, domain name, and port number in the URL. The new HTTP 1.1 is added.
415= "Unsupported media type" is not supported: The format type of the attachment requested by the server does not know how to handle it. The status is newly added to HTTP 1.1.
416= "requested range not satisfiable" request scope does not match: Indicates that the client contains a request for a range header information that the server cannot meet. The status is newly added to HTTP 1.1.
417= "expectation Failed" expected failure: If the server gets a expect request header message with a 100-continue value, this means that the client is asking if an attachment can be sent in a later request. In this case, the server will also use that State (417) to tell the browser that the server does not receive the attachment or use 100 status to tell the client that the attachment can continue to be sent. The status is newly added to HTTP 1.1.

[Server error 5xx] Server errors
>>>500= "Internal Server Error" Internal server errors
>>>501= "Not implemented" cannot be performed: The server does not support the functionality required to complete the request. Tells the client server that the functionality required in the request is not supported. For example, a client executes a command that is not supported by a server such as put.
>>>502= "Bad Gateway" error Gateway: The server receives an invalid response from the upstream server as a gateway or proxy in an attempt to satisfy the access request. This state indicates that the receiving server received an error response from the remote server.
>>>503= Service Unavailable is not available: The server is currently unable to process requests due to temporary overloading or server maintenance. Some servers may want to simply reject the connection. For example, the server should return this header if some thread or database connection pool has not been idle. The server can provide a Retry-after header information to tell the client when to try again.
504= "Gateway Timeout" Gateway Timeout: it indicates that the receiving server did not receive a timely response from the remote server. The status is newly added to HTTP 1.1.
505= "HTTP version not supported" HTTP versions are not supported: The server does not support or rejects the version of the supported HTTP protocol, which is used in the request message. The status is newly added to HTTP 1.1.

Simple version:

Success 2XX successfully processed the requested status code.
200 the server has successfully processed the request and provided the requested Web page.
204 The server successfully processed the request, but did not return any content.

REDIRECT 3XX use redirects in each request no more than 5 times.
301 The requested page has been permanently moved to a new location. When URLs change, use 301 code. The new URL is saved in the Search engine index.
302 The requested Web page is temporarily moved to a new location. The original URL is saved in the Search engine index.
304 If the page has not been updated since the requestor last requested it, use 304 code to tell the search engine robot that it saves bandwidth and overhead.

Client Error 4XX indicates a possible error in the request and prevents the server from processing.
400 the server does not understand the syntax of the request.
403 The server denied the request.
404 the server could not find the requested Web page. Pages that do not exist on the server often return this code.
410 after the requested resource is permanently deleted, the server returns this response. This code is similar to the 404 (not Found) code.
However, in the case where the resource existed before and now does not exist, it is sometimes used to replace the 404 code. If the resource has been permanently deleted, you should use 301 to specify a new location for the resource.

Server error 5XX indicates that an internal error occurred while the server was processing the request. These errors may be the error of the server itself, not the request.
500 the server encountered an error and could not complete the request.
503 servers are not currently available (due to overloading or downtime maintenance). Typically, this is only a temporary state.

Detailed decomposition:
2XX success
200 normal; The request is complete.
201 Normal; Immediately after the POST command.
202 normal; Accepted for processing, but processing is not yet complete.
203 normal; Part of the information-the returned information is only part of it.
204 normal; No response-the request has been received, but there is no information to echo back.

3XX redirection
301 Moved-The requested data has a new location and the change is permanent.
302 found-The requested data temporarily has a different URI.
303 See other-the response to the request can be found under another URI, and the response should be retrieved using the GET method.
304 unmodified-The document was not modified as expected.
305 using a proxy-the requested resource must be accessed through the proxy provided in the Location field.
306 unused-no longer in use; Keep this code for future use.

Errors that occur in the 4XX client
400 Error request-There is a syntax problem in the request, or the request cannot be satisfied.
401 Unauthorized-The client is not authorized to access the data.
402 Payment required-Indicates that the billing system is valid.
403 Forbidden-access is not required even with authorization.
404 Not Found-the server cannot find the given resource; The document does not exist.
407 Proxy authentication Request-The client must first use the proxy to authenticate itself.
415 media type is not supported-the server denies the service request because the format of the requested entity is not supported.

Errors that occur in the 5XX server
500 INTERNAL Error-the server could not complete the request because of an unexpected situation.
501 not executed-the server does not support the requested tool.
502 Error Gateway-server received an invalid response from the upstream server.
503 Unable to get service-the server cannot process the request due to temporary overload or maintenance.
504 Gateway Timeout
When a server acting as a gateway or agent attempts to execute a request, it fails to receive a response from the upstream server (the server that the URI identifies, such as HTTP, FTP, LDAP), or the secondary server (such as DNS).
Note: Some proxy servers return 400 or 500 errors in DNS query timeout
505 HTTP Version not supported
The server does not support or refuses to support the HTTP version used in the request. This implies that the server cannot or does not want to use the same version as the client. The response should contain an entity that describes why the version is not supported and which protocols the server supports.
506 Variant Also negotiates
Extended by the Transparent Content negotiation Protocol (RFC 2295), there is an internal configuration error on behalf of the server: The requested negotiation meta-resource is configured to use itself in transparent content negotiation, so it is not an appropriate focus in a negotiation process.
507 Insufficient Storage
The server cannot store the content necessary to complete the request. The situation is considered to be temporary. WebDAV (RFC 4918)
508 Loop Detected
An infinite loop appears in the server discovery request
509 Bandwidth Limit exceeded
The server reached the bandwidth limit. This is not an official status code, but is still widely used.
510 Not Extended
The policies needed to get resources are not met. (RFC 2774)

PHP output HTTP status code and common status code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.