What Is 304 Status Code and How to Fix It?
An HTTP status code is a response code sent between a browser and a web server every time the browser receives an HTTP request. For example, when you enter a URL to access a website.
When you make a request on your browser, it will send an If-Modified-Since request header to the web server. This request header is sent to know when the web page in question was last modified.
Then, the Last-Modified response header will specify when the web source was last modified. If there’s no change, the server will send the HTTP 304 response code.
The HTTP status code 304 means Not Modified – the web page you requested hasn’t changed since the last time you accessed it.
After that, your browser will retrieve the cached version of the web page in your local storage. That way, the browser doesn’t have to download the same information from the website’s server repeatedly.
This post will further discuss what is the HTTP 304 Not Modified status code and various methods to troubleshoot it.
What Are HTTP Status Codes?
HTTP status codes indicate information exchange. They let you know if the request you made was successful or if there was an error.
There are five categories of HTTP status codes, with each indicating a different type of issue:
- The 1xx status codes – informational requests
- The 2xx status codes – successful requests
- The 3xx status codes – redirects
- The 4xx status codes – client errors
- The 5xx status codes – server errors
However, there are only a few of these codes that you’ll likely encounter directly. If you ever come across any of these response status codes, it means you should take further action to solve the issue.
For example, response codes in the 400s indicate errors, such as the 403 Forbidden, which means you don’t have permission to access a resource.
Then there are the 200s responses like HTTP 200 OK, which communicates your request’s success.
Meanwhile, response codes in the 300s indicate redirection issues, such as the 301 and 302 redirects, used for permanent and temporary redirects.
HTTP 304 requests may improve user experience by speeding up resource page delivery, especially when you have a massive number of web pages.
It optimizes your user experience speed and minimizes the requests that the server has to handle. It also helps search engines crawl your pages more efficiently since they won’t waste their crawl budget on pages that haven’t been updated since their last visit.
However, it may also block the visitor’s access to your content.
What Causes the 304 Not Modified Status Code?
304 Not Modified status codes can happen either on the server or the client-side. However, if a user encounters a 304 Not Modified status code on your site, the error most likely occurred on their part and there isn’t much you can do to fix it.
Here are some of the causes why a user may receive a 304 Not Modified status code:
- Virus – The browser may be corrupted by viruses or malware, which affects its capability of communicating with web servers and caching web pages.
- Recent software installation – If a user just recently installed or uninstalled software on their computer, sometimes the registry can become corrupt. This condition also impacts the browser’s communication and caching function.
- Corrupt application – If a user has any application which has corrupt files related to their browser, it will impact its ability to save web pages and update information.
5 Methods to Fix the 304 Status Code
There are five ways to fix the 304 Not Modified status code. Even though you cannot solve the problem on the client-side, you will be able to recommend possible solutions.
1. Clear Your Browser Cache
You can start by deleting all your browsing data, cookies, and other cached information.
Clearing your browser’s cache will remove all data in your temporary storage. By clearing it once in a while, you’ll save plenty of disk space and enable it to work faster.
Outdated resources in your cache can also stop you from seeing the website’s updated content. Clearing them allows you to acquire a new copy of information from the site’s web server.
If you’re using Google Chrome, follow these steps to clear your browser’s cache:
- Click Customize and control Google Chrome – the three horizontal dots at the top-right corner of your window.
- Navigate to History -> History.
- Click Clear Browsing Data.
- A new window will pop up. Select the Time range – if you want to clear up everything, choose All Time.
- Choose what you want to clear – browsing history, cookies and other site data, cached images and files.
- Click the Clear Data button.
If you use another browser, the steps to clear the browser cache will vary, but we provide a step-by-step guide for different desktop and mobile platforms.
2. Flush the DNS
Similar to web browsers, operating systems also store cache files, but in the Domain Name System (DNS) cache. It contains information about your browsing data, including hostnames, IP addresses, and resource records.
DNS caching helps load web pages faster when you visit them again, lessening the DNS server’s burden when traffic is high.
The cache files have a validity period, which is determined by the Time to Live (TTL) value. Valid DNS caches can answer any content request without going through a DNS server, but they can cause errors or security issues if they’re outdated or corrupted.
Regularly flushing your DNS can improve your operating system’s security and prevent search behavior tracking, making it hard for hackers to predict your browsing history.
It can also solve technical problems, such as connection issues or the HTTP 304 Not Modified response codes.
If you use Google Chrome, flush your DNS by entering chrome://net-internals/#dns into the address bar.
A menu page will open. Click the Clear host cache button.
Google Chrome keeps a separate DNS cache, so it is necessary to flush DNS on your computer as well.
Flushing your operating system’s DNS is also relatively simple. Follow the steps below if you use Windows – it’s applicable for Windows XP, 7, Vista, 8, 8.1, or 10:
- Click the Start button, then navigate to Windows Systems -> Command Prompt.
- The command-line interface will open. Type this command line:
- A confirmation message will appear once the process is successful.
It’s also possible to flush your DNS on other operating systems, such as Mac and Linux.
3. Check Your Redirect Instructions In .htaccess
If none of the previous methods corrected the error message, the issue may be on your server configuration file. For example, your redirect instructions may be incorrect.
To check your server configuration file, you need to know whether your server is running on Nginx or Apache.
If you use Nginx, you don’t have access to the .htaccess file. Check the error logs to see what you need to troubleshoot.
With Apache, check the .htaccess file in your site’s root directory. Log into your hosting account’s File Manager, then navigate to the public_html folder.
Disable the .htaccess by renaming it to .htaccess_disabled. Check the site’s availability and the 304 Not Modified status code while the .htaccess is disabled. Rename it back to .htaccess to enable it again.
If this method resolves the error code, check the code in the .htaccess with your developer. Also, look for incorrect redirect settings, which differ on each website.
4. Run a Malware Scan
Another possible cause of the HTTP 304 Not Modified status is a browser corrupted by a virus or malware infection.
Those threats may interrupt or interfere with your system, including the header request. To identify and remove the threats from your system, run a malware scan.
If you use Google Chrome on Windows, perform it by running the built-in Malware Scanner and Cleanup Tool.
First, check if your Chrome is up to date. Click on the three vertical dots on the top-right of Chrome’s window, then navigate to Settings -> About Chrome.
If you’re not using Chrome’s current version, update it by clicking the Relaunch button.
Now that you’ve updated Chrome, open a new tab and enter chrome://settings/cleanup on the URL bar. Click Find.
It will immediately scan your computer, then provide you with the result report.
Other browsers such as Mozilla Firefox and Microsoft Edge don’t have a built-in malware scanner. The same goes for other operating systems like Mac and Linux.
If you use these browsers or operating systems, run the malware scan with the antivirus software on your computer.
5. Disable Browser Extensions
Infected browser extensions can also interfere with requests and server communication, causing the HTTP 304 Not Modified status code.
Disable your browser’s extensions to solve this issue. The steps vary for each browser, so here is a guide for four major browsers – Google Chrome, Mozilla Firefox, Safari, and Microsoft Edge.
Navigate to Settings -> Extensions. On the Extensions page, disable each extension by clicking on their toggle switches.
Click the Remove button if you want to delete unused or outdated extensions.
- Click the Open menu icon on the top-right of your Mozilla Firefox window, then select Add-ons.
- On the Add-ons Manager tab, select Plugins.
- Choose the plugins that you want to disable by selecting Never Activate on the drop-down menu.
- If you want to re-enable the plugin, check the Disabled plugins list and select Always Activate on the drop-down menu.
- On Safari, open the menu and select Preferences.
- Click the Extensions icon.
- Deselect an extension’s checkbox to turn it off.
- If you no longer need an extension, it’s better to uninstall it. Click the Uninstall button to do so.
Navigate to Settings and more on the top-right corner of the Microsoft Edge window. Select Extensions.
Click on the extension’s toggle switch to disable it. It will erase the extension icon next to the address bar.
We recommend relaunching your browser once you finish disabling the extensions to get the best results. After that, check the URL that you initially wanted to visit. See if it still has the HTTP 304 Not Modified status code.
If it resolves the issue, it’s safe to re-enable your extensions one by one.
Troubleshooting Other Errors
If you come across the HTTP 304 Not Modified status code when accessing a website, it means your browser and the web server experienced a communication issue.
This status code can appear on both your side or your site visitors’ and might block access to your content.
The HTTP 304 Not Modified status code indicates that there is no need to retransmit the resources you request – it will redirect you to cached content instead.
However, the 304 status code may also indicate that your browser or server is not configured correctly, causing issues in the communication between the two.
There are five methods you can follow to fix this issue:
- Clearing your browser cache
- Flushing the DNS
- Checking your redirect instructions in .htaccess
- Running malware scan
- Disabling the browser extensions
After performing each method, make sure to recheck everything by relaunching your browser.
Keep in mind that it is not possible to solve the 304 not modified status code on your visitor’s side, but you’ll be able to provide them with a resource to fix the error codes.