304 Not Modified

What is 304 Not Modified Response?

The 304 Not Modified HTTP server response code indicates that the requested resource has not been modified since the last time it was loaded, and there’s no need to transfer it again. 

For browsers, this means that the cached version of the resource can be shown to the user. For crawlers, such as Googlebot, it means that there’s no need to recrawl the page because nothing has changed on it.

Here’s how it works (in simple terms):

  1. When the client (browser or crawler) requests a resource from the web server for the first time, the server sends the requested resource (with the 200 OK HTTP code) along with its hash code, called ETag. The client also records the time when it requested the page/resource.
  2. When the client requests the resource again, the server checks the If-None-Match and/or If-Modified-Since request readers from the client. This is a so-called conditional HTTP request.

    If-None-Match contains the ETag (content hash code). If it matches the value on the server, this indicates that the content has not been changed, and there’s no need to load it again (when the content changes, so does its hash code).

    If-Modified-Since contains the date and time when the client last requested the content. If the server sees that content was not changed since this date, there’s no need to send the resource to the client.

    In both cases, the server will respond with the 304 HTTP code.

    When both If-None-Match and If-Modified-Since are used, If-None-Match takes precedence over If-Modified-Since.

  3. When the browser receives the 304 Not Modified HTTP code from the server, it will show the cached version to the user. That is why 304 is one of the client-side redirection codes.

Why Is the 304 response code important?

For small websites, the caching opportunities that the 304 HTTP code provides are not that crucial.

However, for large websites, the 304 response code is a great opportunity to save the crawl budget. Google’s crawler won’t recrawl the pages that were not changed and will be able to crawl more new and updated pages instead.