What is HTTP 304 Not Modified?
HTTP status code 304 Not Modified indicates that the resource you are trying to access hasn't changed since your last request. In this case, the server does not send the content again, but expects the browser to display a version that has already been stored in its cache.
The status code 304 is used to avoid unnecessary data transfer, because the client already has the requested resource stored locally. This reduces bandwidth consumption and speeds up page or resource loading.
HTTP 304 Not Modified belongs 3xx HTTP status code group, where:
- number 3 denotes redirection
- xx presents additional digits that more accurately describe the status of the HTTP request
How does HTTP 304 Not Modified work?
HTTP 304 Not Modified is considered a shape client redirection, because the processing takes place on the client side, i.e. the user's device or system.
The process begins when a client, such as a web browser or web crawler, sends an HTTP request to a server. In this example, the client asks for access to the website at yourdomain.com. The server then checks whether the requested resource has changed since the last time the client accessed the page.
If there was no change, the server returns the answer 304 Not Modified without resubmitting content. The browser then loads the already saved version from the cache, resulting in a faster page view and less server load.
GET /index.html HTTP/1.1 Host: yourdomain.com
If the client sends a request for the first time, the server matches with the code 200 OK i ETag the label. The requested resource is then included in the body of the message.
HTTP/1.1 200 OK ETag:92g93nb790256hwp72b9
ETag (abbreviated from entity tag) is an HTTP response header consisting of a series of numbers, letters and symbols, which serves to identify a specific version of the resource sent to the client. ETag changes every time a resource is updated.
When the client resubmits a request for access to the same resource, they will include a header in the request If-None-Match. This header contains the ETag that the server sent to the client on the previous visit.
Some clients may also include a header If-Modified-Since, which shall contain 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
Server will then compare header values If-None-Match i If-Modified-Since with the data it has saved. If the values match, the server will not send the resource. Instead, it will respond with a status code 304 Not Modified, indicating that the resource has not changed since the last customer visit.
HTTP/1.1 304 Not Modified
If the client is an Internet browser, he will show the visitor a version of the resource that is already in his cache. If the client is a search engine, like Google, they will use a version of the content they have previously stored.
It is important to note that the header If-None-Match takes precedence over If-Modified-Since. Still, If-Modified-Since It is used more often because it is easier to implement.
How Googlebot uses HTTP 304 Not Modified
Google supports headers If-Modified-Since i If-None-Match and expects the server to restore the status code 304 Not Modified if the content has not changed since the last visit of Googlebot.
However, Google does not include these headers in every request when indexing your site. It only uses them when it deems them necessary for a particular crawl.
Even in cases where Google does not send these headers, the server can be configured to return the response to Googlebot 304 Not Modified if the content has not been changed since his last visit.
SEO Benefits of Status Code 304 Not Modified
Status code 304 Not Modified Assisting in the management of the c. crawl budget. Crawl budget represents the maximum number of pages that a search engine can view on your website within a certain period of time.
When search engines index a website, they consume server resources and bandwidth. If they visit your site too often, they can unnecessarily burden the server, which can lead to a slowdown of the site or even temporary unavailability.
To avoid this, search engines assess the server's capacity and, based on this, determine the crawl budget, thereby trying to preserve the site's performance and the quality of the user experience.
For smaller websites crawl budget is generally not a problem. It becomes relevant the code of pages with 10,000 or more unique URLs or the code of pages whose URLs are marked as Discovered – not indexed Google Search Console.
It is important to note that the estimated server capacity used by Google does not have to match the actual capacity of your server. Google determines it according to its own criteria and is often more conservative than the actual server capabilities.
Other Benefits of Status Code 304 Not Modified
In addition to SEO benefits, status code 304 Not Modified It also brings tangible benefits to visitors and search engines.
Visitors consume less data because the content is not downloaded from the server again, but is loaded from the browser cache. This also allows you to load the page faster.
Search engines, on the other hand, use large amounts of resources to index the Internet. Since these resources are not unlimited, the status code 304 prevents them from spending resources again on uploading content that has not changed.
