What is 304 Not Modified status code?
The 304 Not Modified status code indicates that the requested page or resource has not been modified since it was last accessed, and there is no reason to retransmit it. For browsers, this means that the resources stored in the browser cache haven’t been modified since the last time the user accessed it, and the cached version is displayed to them. For search engine crawlers, such as Googlebot, it means that there is no need to crawl the page because nothing has changed on it.
Here’s how it works (simplified):
When the client (browser or crawler) requests a resource from the server for the first time, the server sends the requested resource (with HTTP status code 200 OK) along with its hash code, called the ETag. The client also documents the time when it requested the page/resource.
If a browser or crawler makes another request for a web page, it asks the server whether there is a newer version of the resource than the one already cached. This is done using certain conditional headers, such as “If-Modified-Since” or “If-None-Match”, which contain information about the last loaded version of the resource.
When the server receives this request again from the same client, it checks whether the resource in question has been modified since the date specified in the header. If the resource has remained unchanged, the server responds with status code 304. This means that the browser should use the already cached version of the resource. It eliminates the need to download the resources again, conserves network bandwidth, and reduces page load time.
Why is HTTP status code 304 important?
For small websites with few visitors, the caching capabilities offered by HTTP status code 304 are not that important. But for large websites, the HTTP status code 304 is an excellent option to save on bandwidth cost and crawl budget. Google’s crawlers will not crawl the pages that have not changed and instead will be able to crawl more new and updated pages.