List of HTTP Status Codes

This is a list of HTTP status code responses. Code examples for are included.

1616 views

Edited: 2021-04-20 09:06

This is a list of HTTP Status Codes. You can use this as a reference when creating responses in your server-sided programming language.

In PHP, status codes can be delivered with the header function.

Success Codes

The below is a table of common HTTP Response Codes.

200 OKThe server returned the resource successfully.
201 CreatedThe request has been fulfilled and resulted in a new resource being created.
202 AcceptedThe request has been accepted for processing, but the processing has not been completed.
203 Non-Authoritative InformationThe returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy.
204 No ContentThe server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation.
205 Reset ContentThe server has fulfilled the request and the user agent SHOULD reset the document view which caused the request to be sent.
206 Partial ContentThe server has fulfilled the partial GET request for the resource. The request must have included a Range header field.
304 Not ModifiedThe resource has not been modified, and no response body is sent.

Redirection Codes

Here are some of the common redirection codes. Most of these response codes should be sent a long with a location for the new resource, which should be provided in the location header.

301 Moved PermanentlyThe resource has Permanently moved, and future requests should be made for the given URL.
302 FoundThe resource is temporarily located at a different location, and since this location may change from time to time, the client should continue to use the original URL for future requests.
303 See OtherThe response for the request can be found at a different URL.

4xx Response Codes

These are some of the common error codes send by servers.

400 Bad RequestThe syntax of the request was bad, and the client should not repeat the request without modifications.
401 UnauthorizedThe request requires a user to be logged in, the response must include a WWW-Authenticate header field.
403 ForbiddenThe server understood the request, but is refusing to fulfill it. I.e. The user entered a wrong username or password.
404 Not FoundThe requested resource could not be found. I.e. Nothing can be found here, i have looked absolutely everywhere technically possible, and nothing can be found.
405 Method Not AllowedThe request method was not allowed (E.g. POST, PUT, GET, DELETE).

Tell us what you think:

  1. An in-dept look at the use of headings (h1-h6) and sections in HTML pages.
  2. Pagination can be a confusing thing to get right both practically and programmatically. I have put a lot of thought into this subject, and here I am giving you a few of the ideas I have been working with.
  3. The best way to deal with a trailing question mark is probably just to make it a bad request, because it is a very odd thing to find in a request URL.
  4. How to optimize image-loading and automatically include width and height attributes on img elements with PHP.
  5. HTTP headers are not case-sensitive, so we are free to convert them to all-lowercase in our applications.

More in: Web development