Share via:

HTTP 200 Ok

Reference on the HTTP 200 ok response message.


Edited: 2019-11-23 05:48

The 200 Ok status message is sent by a server to indicate that it was able to process and respond to a HTTP request it has received.

200 ok is typically accompanied by a response body containing either HTML, XML or plain text. But, it can also be followed by an image or a video.

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8

200 Ok and caching

By default, a server will respond with a 200 ok code if the HTTP request was processed successfully. But, it may also respond with a 304 Not Modified code, indicating that the resource should instead be loaded from the browsers cache.

If you want to leverage caching in dynamic web applications, such as content delivered with PHP, you will need implement some sort of caching mechanism. One way to do this is to store "articles" in the database together with a timestamp and then use the IF-MODIFIED-SINCE header.

See also: 304 Not Modified

In PHP you usually do not need to send a 200 Ok response, since it is the default response when none is given.

To find out how to send HTTP response codes in PHP see: PHP: Header