What is HTTP 304 Not Modified?
The HTTP 304 Not Modified status code indicates the resource you are trying to access has not been modified since your last request. The server will not resend the resource to you and expects your browser to show you the one in its cache.
The 304 Not Modified status code prevents unnecessary data transfer, as the client already has the resource in their cache. This reduces bandwidth usage and increases the speed at which you access a resource.Â
The 304 Not Modified belongs to the 3xx series of HTTP status codes.
3
indicates the status code is a redirectionxx
is a placeholder for two numbers, which provide more specific information about the status of the HTTP request
How the 304 Not Modified Status Code Works
The 304 Not Modified status code is considered a client-side redirection because it occurs on the client’s device or system. Here is a breakdown of how it works.Â
The process begins with the client, such as a browser or web crawler, sending an HTTP request to a server. In this example, the client requests to access your webpage at yourdomain.com.
GET /index.html HTTP/1.1 Host: yourdomain.com
If the client is making the request for the first time, the server responds with a 200 OK response code and an ETag. The requested resource is then included in the message body.Â
HTTP/1.1 200 OK ETag:92g93nb790256hwp72b9
The ETag, short for entity tag, is an HTTP response header consisting of a string of numbers, letters, and symbols for identifying the specific version of the resource sent to the client. It changes every time the resource is updated.Â
Now, when the client makes another request to access the same resource, it will include an If-None-Match header request. This If-None-Match header request contains the ETag the server sent to the client during the previous visit.
Some clients may also include an If-Modified-Since header request containing the time of the last request.
GET /index.html HTTP/1.1 Host: yourdomain.com If-None-Match: 92g93nb790256hwp72b9 If-Modified-Since: Fri, 19 Apr 2024 12:00:59 GMT
The server will then compare the values of the If-None-Match and If-Modified-Since header requests with what it has on file. If there is a match, the server will not send the resource. Instead, it will reply with a 304 Not Modified response code, indicating the resource has not changed since the client’s last visit.
HTTP/1.1 304 Not Modified
If the client is a browser, the browser will then display the version of the resource available in its cache to the visitor. If it is a search engine, it will use the version it previously stored.Â
That said, If-None-Match has a higher priority than the If-Modified-Since header request. However, the If-Modified-Since header request is more common since it is easier to implement.
How Googlebot Interacts With the 304 Not Modified
Google supports the If-Modified-Since and If-None-Match request headers and expects servers to return the 304 Not Modified response code if the resource has not been updated since its last visit.Â
However, Google does not always include the header requests whenever it wants to crawl a resource on your site. It only includes them if it thinks they are necessary for the crawl.
Even if Google does not include the header requests, you could configure your server to reply to Googlebot’s request with a 304 Not Modified status code if the content has not changed since its last visit.
SEO Benefits of the 304 Not Modified Status Code
The 304 Not Modified Status Code is helpful for managing your site’s crawl budget. The crawl budget is the maximum number of pages a search engine will crawl on your site within a period.Â
Search engines consume bandwidth when they crawl your site. If they crawl your site too often, they may use up a substantial part of your bandwidth, overloading your server and causing your site to slow down or crash.Â
To avoid overloading your server, search engines estimate your server capacity and then set a crawl budget to ensure they do not cause performance and usability issues for your visitors.
However, smaller sites do not have to bother about their crawl budget, and it is only typically an issue for sites with 10,000 or more unique pages and sites whose URLs are classified as Discovered – Currently not indexed in Google Search Console.
It is important to know that your estimated server capacity is unrelated to your actual server capacity. Google estimates your server capacity based on certain criteria, and it is normal for the estimate to be lower than your actual server capacity.Â
Other Benefits of the 304 Not Modified Status Code
Besides the SEO benefits, the 304 Not Modified status code offers some real non-SEO benefits to your visitor and the search engine.Â
The 304 Not Modified status code allows visitors to save the data they would have expended on retrieving the resource from the server. Visitors can also access the resource quicker since it is fetched from their browser rather than downloaded from a server.Â
Search engines, on the other hand, consume a lot of resources to crawl the internet. Since they do not have infinite resources, the 304 Not Modified status code prevents them from using their limited resources to crawl the same resource repeatedly.Â