Table of Contents
What is the 404 error code?
The 404 error code, also known as “404 Not Found,” is an HTTP status code that indicates the requested resource or webpage could not be found on the server. It is one of the most common and recognizable error codes encountered while browsing the web.
When you encounter a 404 error, it means that the server was successfully contacted, but it could not locate the specific resource you requested. This could occur due to various reasons, such as:
- Mistyped URL: If you entered the URL incorrectly, the server will not find the corresponding resource and respond with a 404 error.
- Deleted or moved resource: The resource you are trying to access may have been deleted or moved to a different location on the server. As a result, the server cannot find the requested resource and returns a 404 error.
- Broken links: If you clicked on a link from a webpage or search engine result that points to a non-existent or outdated resource, you will receive a 404 error when attempting to access it.
When you encounter a 404 error, it’s generally recommended to check the URL for any typos or errors. You can also try refreshing the page or clearing your browser cache to ensure you’re not loading a cached, outdated version of the webpage. If the error persists, it’s likely an issue with the availability or location of the requested resource on the server.
Why does it happen?
The 404 error code is a very common error message. The 404 error indicates that a specific page you tried to access a website doesn’t exist in the server. This error message is part of the HTTP/1.1 Status Codes definitions. Whenever you try to reach a page, the web server tries to find it in the local repository of files. If the server can’t find the file, or maybe if the file has a different name, then the server is unable to open the corresponding file. So, you will see the 404 error code in the web browser.
Basically, there are similar error codes, just like 500 (Internal Server Error) and 403 (Not authorized). So, the webserver throws them for different reasons. In this article, we will explore the causes of the 404 error code, and we will show you how to fix this. This error can happen both in HTTP or HTTPS servers.
How the 404 error code looks in the browser
This is how the message is presented by default. There are methods to customize the 404 error page. Is shows the error 404 texts like in the image:
The cause of the 404 error code
Basically, the 404 error indicates that a file doesn’t exist in the web server. There are other causes like .htaccess configurations or wrong redirects that may apply. In this article, we will explore and explain the most common cause, which is a non-existent file.
For example, we will show a case of a user trying to access http://www.mysamplewebsite.com/filename.htm . In this request, the web server tries to find filename.htm in the local disk. By default, you must store the files inside the public_html folder using FTP. As the file filename.htm doesn’t exist, the server shows the text of the 404 error code to the user.
How do I fix the 404 error
Firstly, to fix the 404 error code you have to upload the file to the server. Make sure you place the file inside the public_html folder. In the following image, we will show the filename.htm uploaded by FTP to the server. Now, the problem is gone and the URL of our example can be accessed without this error message.
You can see in this other article the complete definition of HTTP/1.1 Status Codes
Causes for the error 404 in WordPress
In WordPress, the 404 error can occur due to several reasons. Here are some common causes for the 404 error in WordPress:
- Permalink issues: WordPress uses a feature called “Permalinks” to create user-friendly and search engine optimized URLs. If the Permalinks settings are misconfigured or the .htaccess file (which handles URL rewriting) is not properly set up, it can lead to 404 errors when accessing posts, pages, or other content.
- Deleted or unpublished content: If you or someone with administrative privileges has deleted a page or post, or if the content was never published in the first place, attempting to access that specific URL will result in a 404 error.
- Plugin or theme conflicts: Sometimes, conflicts between plugins or themes can cause issues with URL routing, resulting in 404 errors. It may occur when a plugin or theme tries to modify or handle URLs in a way that conflicts with WordPress core functionality.
- Incorrectly configured redirects: If you have set up redirects using a plugin or a server-level redirect configuration, incorrect or misconfigured redirects can lead to 404 errors when attempting to access certain URLs.
- File permission issues: In some cases, incorrect file permissions on the server can prevent WordPress from accessing or serving the requested content, resulting in 404 errors.
- Caching-related issues: If you are using a caching plugin or server-level caching mechanisms, outdated or misconfigured cache settings can cause 404 errors when trying to access updated content.
How to fix in WordPress
- Check your Permalinks settings in the WordPress admin dashboard and ensure they are configured correctly.
- Regenerate the .htaccess file by saving the Permalinks settings again.
- Verify that the content you are trying to access exists and is published.
- Disable plugins one by one to identify if any specific plugin is causing the issue.
- Review any custom redirects or rewrite rules that may be conflicting.
- Check file permissions and ensure they are set correctly for the WordPress installation.
- Clear any caches, both within WordPress (if using a caching plugin) and in your browser.
If the issue persists, it may be worth reaching out to your web hosting provider. Also, try to seek further assistance from the WordPress community or support forums.
Disabling plugins in WordPress
Disabling plugins in WordPress may help resolve a 404 error in certain cases. Specially if the error is caused by a conflict or issue with a specific plugin. Here’s how disabling plugins can be beneficial:
- Plugin conflict: Sometimes, conflicts between plugins can result in unexpected behavior, including 404 errors. By disabling plugins one by one, you can identify if a specific plugin is causing the conflict. If disabling a particular plugin resolves the 404 error, it indicates that the plugin was likely the source of the issue.
- Plugin-related URL rewriting: Some plugins modify URL structures or handle URL routing in WordPress. If a plugin’s configuration or functionality is misconfigured or incompatible with your site, it can lead to incorrect URL rewriting, resulting in 404 errors. Disabling the problematic plugin can help determine if it’s responsible for the issue.
- Plugin-related redirects: If you have set up redirects using a plugin, an incorrectly configured or conflicting redirect rule may cause 404 errors. Disabling the plugin temporarily can help identify if the redirects were causing the issue.
Disabling plugins can be a helpful troubleshooting step. It’s important to note that it might not always directly resolve a 404 error. A 404 error can stem from various factors, including incorrect Permalinks, deleted content, theme issues, or server misconfigurations.
If disabling plugins doesn’t resolve the 404 error, you may need to further investigate and troubleshoot other potential causes. Review your Permalinks settings, checking for deleted or unpublished content. Also, ensure your theme is functioning correctly, and investigating server configurations. These are additional steps you can take to address the issue.
Remember to document the changes you make during the troubleshooting process, and if necessary, consult with WordPress support forums or seek assistance from experienced developers to help diagnose and resolve persistent 404 errors.
Disabling plugins in Wordperss is very simple
To disable plugins in WordPress, just click Installed plugins, under Plugins.
Afterwards, click Deactivate under your installed plugins.
Fixing wrong redirections in WordPress
A very common cause for this issue is a wrong link in your posts or pages. Your web pages may have moved, likely due to a configuration change, or even due to a Permalinks change.
In this case, we strongly recommend using the Redirection plugin. This way you can redirect yor traffic via 301 (Permanent redirect) to the correct page.
After installing the Redirections plugin, you must Add a new entry for each page that moved.
Now, just place the Source URL (which is the URL that is showing Error 404). Also set the Target URL, which is the correct URL for the content.
The HTTP 404 error may also decrease your search engine rankings
It’s not uncommon, and you have probably seen the 404 error message when searching in Google. Whenever a requested page returns such error, the search engines decrease its ranking. Google and other search engines evaluate the user experience. Whenever a user searches for something, the search engine must provide the greatest answer possible.
For domains with lots of pages showing the HTTP 404 error, Google can also apply a ranking penalty. Even for the other pages. It understands that such domain delivers a bad user experience.
Broken links can also harm your Google ranking positions. Every search engine has bots, which keep crawling all the internet 24 hours a day. Whenever they find a broken external link on your website, they also decrease your domain evaluation.
Other uncommon possible causes for this error
Not only problems with the server or files can cause such error. Client-side issues can also be a possible cause. For example, infected clients with spyware or viruses can have their URL’s automatically redirected. There are also spywares that can change your hosts file, overlapping your provider’s DNS servers. This can redirect your navigation to other external sites, throwing 404 errors.
Browser caches can also cause this issue. Some older browsers used to keep caches for a long time so that users needed to clear them actively. Today’s browsers have better cache control, and this possible cause isn’t as common as it was in the past.
Another possibility is a delay in DNS propagation. Delays in DNS servers to update their records can also point your website’s IP address to a wrong or outdated web server.
FAQ
Custom 404 error page
It’s possible to have a customized 404 error page, with your own text and images. In this article, we explain in details how to have a personalized page for the 404 error.
What is an HTTP status code?
The 404 error is an HTTP status code that is part of the HTTP protocol. HTTP status codes are three-digit numbers returned by a web server to provide information about the status of a client’s request. Each status code carries a specific meaning and helps to facilitate communication between the client (typically a web browser) and the server.
Specifically, the 404 error is represented by the HTTP status code “404 Not Found.” When a client (such as a web browser) sends a request to a server for a specific resource, the server responds with the appropriate status code to indicate the outcome of the request.
The 404 status code indicates that the requested resource could not be found on the server. This may be due to various reasons, such as a mistyped URL, a deleted or moved resource, or a broken link. The server is effectively saying, “I understand your request, but I cannot find the resource you’re looking for.”
When a server returns a 404 error, the client (usually a web browser) will display a corresponding error page, typically with a message informing the user that the requested page could not be found.
A client-side error in HTTP
The 404 error is a client-side error, indicating that the client made a request for a resource that the server was unable to locate. It is important to note that the 404 error does not indicate an issue with the server itself, but rather with the specific requested resource.
Web developers and website administrators often customize the appearance of their 404 error pages to provide a more user-friendly experience, offering suggestions for navigating to other parts of the website or providing a search box to help users find the desired content.
HTTP status codes, including the 404 error, are an essential part of the web infrastructure and communication between clients and servers. They help diagnose and communicate the outcome of requests, enabling efficient troubleshooting and error handling.
Some historic 404 error memes
Having a 404 error page shown on a website isn’t the end of the world. Many companies make fun of it. We have chosen a few memes as examples:
Conclusion
Basically, the 404 error text can be fixed at the FTP site of the server. The user has to make an FTP file transfer in order to place the non-existing files in the web hosting server. Also, in some times, the user needs to rename the files to adjust the file names with the links on the website.