{"id":2381,"date":"2025-07-21T21:22:03","date_gmt":"2025-07-21T18:22:03","guid":{"rendered":"https:\/\/accessily.com\/blog\/?p=2381"},"modified":"2025-07-21T21:22:03","modified_gmt":"2025-07-21T18:22:03","slug":"304-not-modified","status":"publish","type":"post","link":"https:\/\/accessily.com\/blog\/304-not-modified\/","title":{"rendered":"304 Not Modified"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_69 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#How_Does_a_304_Not_Modified_Work\" title=\"How Does a 304 Not Modified Work?\">How Does a 304 Not Modified Work?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#How_to_Implement_304_Not_Modified\" title=\"How to Implement 304 Not Modified\">How to Implement 304 Not Modified<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#Common_Issues_and_Solutions\" title=\"Common Issues and Solutions\">Common Issues and Solutions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#Best_Practices_for_Using_304_Not_Modified\" title=\"Best Practices for Using 304 Not Modified\">Best Practices for Using 304 Not Modified<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#Advanced_Use_Cases_for_304_Not_Modified\" title=\"Advanced Use Cases for 304 Not Modified\">Advanced Use Cases for 304 Not Modified<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#Real-World_Examples\" title=\"Real-World Examples\">Real-World Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/accessily.com\/blog\/304-not-modified\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>A 304 Not Modified status code is an HTTP response that indicates the requested resource has not been modified since the last time it was accessed. This means there is no need to retransmit the resource, as the client can use the cached version. This status code is particularly useful for improving web performance and reducing unnecessary data transfer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_Does_a_304_Not_Modified_Work\"><\/span>How Does a 304 Not Modified Work?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>When a client (such as a web browser) requests a resource from a server, it often includes headers like If-Modified-Since or If-None-Match. These headers contain information about the last modification date or an <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Headers\/ETag\">ETag<\/a> (a unique identifier for a specific version of the resource). If the server determines that the resource has not changed since the specified date or ETag, it responds with a 304 Not Modified status code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example Scenario<\/h3>\n\n\n\n<p>Imagine you visit a website, and your browser caches the resources (like images, CSS, and JavaScript files). The next time you visit the same website, your browser sends a request to the server with the If-Modified-Since header. If the server finds that the resources have not changed, it responds with a 304 Not Modified status code, allowing your browser to use the cached versions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Benefits of Using 304 Not Modified<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Improved Performance: <\/strong>By allowing browsers to use cached resources, 304 Not Modified reduces the amount of data that needs to be downloaded, leading to faster page load times.<\/li>\n\n\n\n<li><strong>Reduced Bandwidth Usage:<\/strong> Since the server does not need to resend unchanged resources, it saves bandwidth, which can be particularly beneficial for websites with high traffic.<\/li>\n\n\n\n<li><strong>Enhanced User Experience:<\/strong> Faster page loads and reduced data usage contribute to a better overall user experience, especially for users with slower internet connections.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Implement_304_Not_Modified\"><\/span>How to Implement 304 Not Modified<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Implementing 304 Not Modified involves configuring your server to handle conditional requests. <br>Here are some common methods:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><span style=\"text-decoration: underline;\">Apache Server:<\/span><\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Header set Cache-Control \"max-age=3600, public\"<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><span style=\"text-decoration: underline;\">Nginx Server:<\/span><\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/ {<br>expires 1h;<br>add_header Cache-Control \"public\";<br>}<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><span style=\"text-decoration: underline;\">Using PHP:<\/span><\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$lastModified = filemtime(\"yourfile.txt\");\n$etag = md5_file(\"yourfile.txt\");\n\nheader(\"Last-Modified: \" . gmdate(\"D, d M Y H:i:s\", $lastModified) . \" GMT\");\nheader(\"Etag: $etag\");\n\nif (@strtotime($_SERVER&#91;'HTTP_IF_MODIFIED_SINCE']) == $lastModified || \n@trim($_SERVER&#91;'HTTP_IF_NONE_MATCH']) == $etag) {\nheader(\"HTTP\/1.1 304 Not Modified\");\nexit;\n}\n?&gt;<\/code><\/pre>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_Issues_and_Solutions\"><\/span>Common Issues and Solutions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Issue: Browser Not Respecting 304 Not Modified<\/h3>\n\n\n\n<p>Sometimes, browsers may not respect the 304 Not Modified status code due to incorrect cache settings. Ensure that your server is correctly configured to handle caching and conditional requests.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution: Clear Browser Cache<\/h3>\n\n\n\n<p>Clearing the browser cache can resolve issues where outdated resources are being used. This forces the browser to request fresh copies of the resources.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Best_Practices_for_Using_304_Not_Modified\"><\/span>Best Practices for Using 304 Not Modified<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Set Appropriate Cache-Control Headers: Use headers like Cache-Control and Expires to define caching policies and ensure that resources are cached appropriately.<\/li>\n\n\n\n<li>Monitor Cache Performance: Regularly monitor your server logs and performance metrics to ensure that caching is working as expected and that 304 Not Modified responses are being utilized effectively.<\/li>\n\n\n\n<li>Update Resources When Necessary: While caching is beneficial, ensure that critical updates to resources are reflected by updating the Last-Modified date or ETag.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Advanced_Use_Cases_for_304_Not_Modified\"><\/span>Advanced Use Cases for 304 Not Modified<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Geo-Targeting<\/h3>\n\n\n\n<p>A 304 redirect can be used for geo-targeting, where users from different regions are redirected to region-specific pages. For example, visitors from the US might be redirected to a US-specific page, while visitors from Europe are redirected to a European page. This allows for a more personalized user experience without permanently altering the URL structure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Device-Specific Content<\/h3>\n\n\n\n<p>Another advanced use case is redirecting users based on their device. For instance, <a href=\"https:\/\/accessily.com\/blog\/top-ten-mobile-seo-tips\/\" data-type=\"post\" data-id=\"664\">mobile<\/a> users can be redirected to a mobile-optimized version of a page, while desktop users remain on the standard version. This ensures that all users have an optimal browsing experience tailored to their device.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Real-World_Examples\"><\/span>Real-World Examples<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1: E-commerce Websites<\/h3>\n\n\n\n<p>E-commerce websites often have a large number of images and product pages. By using 304 Not Modified responses, these websites can ensure that returning visitors experience faster load times, as their browsers can use cached images and resources. This not only improves user satisfaction but also increases the likelihood of repeat purchases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example 2: News Websites<\/h3>\n\n\n\n<p>News websites frequently update their content but also have a lot of static resources like CSS and JavaScript files. Implementing 304 Not Modified responses for these static resources ensures that users can quickly access the latest news without waiting for all resources to reload.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Monitoring and Analytics<\/h3>\n\n\n\n<p>To ensure that your 304 Not Modified responses are working effectively, it&#8217;s important to monitor your server logs and use analytics tools. These tools can help you track the number of 304 responses, identify any issues with caching, and measure the impact on page load times and user engagement.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The 304 Not Modified status code is a <a href=\"https:\/\/accessily.com\/blog\/guest-posting-brand-awareness-tool\/\" data-type=\"post\" data-id=\"501\">powerful tool<\/a> for optimizing web performance and reducing unnecessary data transfer. By understanding how it works and implementing it correctly, you can enhance your website&#8217;s speed, reduce bandwidth usage, and improve the overall user experience.<\/p>\n\n\n\n<p>Implementing 304 Not Modified responses effectively requires careful configuration and monitoring, but the benefits in terms of performance and user satisfaction are well worth the effort.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>A 304 Not Modified status code is an HTTP response that indicates the requested resource has not been modified since<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":2383,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,92],"tags":[],"class_list":["post-2381","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo","category-seo-glossary"],"_links":{"self":[{"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/posts\/2381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/comments?post=2381"}],"version-history":[{"count":3,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/posts\/2381\/revisions"}],"predecessor-version":[{"id":2385,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/posts\/2381\/revisions\/2385"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/media\/2383"}],"wp:attachment":[{"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/media?parent=2381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/categories?post=2381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/accessily.com\/blog\/wp-json\/wp\/v2\/tags?post=2381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}