HTTP status codes are used to indicate the result status of a web server when processing an HTTP request. HTTP status codes consist of three-digit numbers and are divided into five categories:
- 1xx (Informational status codes): The request has been received and is being processed.
- 2xx (Success status codes): The request has been successfully received, understood, and accepted by the server.
- 3xx (Redirection status codes): Further action is required by the client to complete the request.
- 4xx (Client error status codes): The request contains syntax errors or cannot be completed.
- 5xx (Server error status codes): The server encountered an error while processing the request.
Some common and valid HTTP status codes include:
- 200 OK: The request has been successfully received, understood, and accepted by the server.
- 201 Created: The request has been fulfilled, and a new resource has been created according to the request.
- 204 No Content: The server has successfully processed the request but does not need to return any entity content, and it expects to return updated metadata.
- 206 Partial Content: The server has successfully processed a partial GET request.
- 301 Moved Permanently: The requested resource has permanently moved to a new location.
- 302 Found: The requested resource has temporarily moved to a new location.
- 304 Not Modified: The resource has not been modified and can be accessed using the client's cached version.
- 400 Bad Request: The server cannot understand the request format, and the client should not attempt to resend the same content.
- 401 Unauthorized: The request requires authentication and is not authorized.
- 403 Forbidden: The server understands the client's request but refuses to fulfill it.
- 404 Not Found: The server cannot find the requested resource based on the client's request.
- 500 Internal Server Error: The server encountered an internal error and cannot complete the request.