404 Not Found: What is it and How to fix it?
Table of Contents
Surely, you have tried accessing a specific web page only to stumble upon a 404 error message. The Error code 404 is an HTTP Status Code that indicates that the page you are trying to visit is not present on the web server. Seeing this code as a website visitor, you will most likely close the tab and find what you are looking for elsewhere. Still, there are a few things you can do to try and resolve the issue on your end.
If you are the website owner, however, you should take prompt action to solve it. For example, there may be a page for which you changed the URL and forgot to redirect it, or a missing asset on your site causing the error. Due to that, your visitors would see a 404 error code when they try to open a product or a specific web page on your website. Fixing it will help you prevent losing traffic or SEO ranking.
In this article, we will examine what error 404 is, what causes it, its SEO impact, and how you can fix it. We will also show you how you can create a custom 404 page to help keep your visitors engaged.
In simple terms, this definition states that the resource you are looking for is either not present on the server, or there is a 301 redirect, routing 404 pages to existing ones.
When you are reaching a web page on the network, you are practically requesting the server that hosts this website. Generally, the server will respond with the content you are requesting. However, if the server is unable to find what you are looking for, it will respond with an error 404 Not Found.
Many site owners prefer to create their own 404 page where they advise visitors to use the search function on the website, check a relevant page, or go back to the home page. This way, it is more likely for a customer to repeat the search or find similar answers within the same site.
In any case, the server responds with a 404 status code not only for a missing page but virtually for any absent asset on a site – an image file or CSS/JavaScript files.
What Does Error 404 Not Found Look Like?
You may encounter the error page 404 presented in various designs and wording depending on your browser or the website you want to visit, although it points to the same underlying issue.
The most common variations for a 404 error are listed below:
- Error 404
- 404 Not Found
- HTTP Error 404
- Not Found
- Page Not Found
- The requested URL was not found on this server
- The page cannot be found
- We can’t find the page you’re looking for
- The requested URL /~ was not found on this server. That’s all we know
The standard error page is pretty straightforward and simple in design, as shown in the screenshot below:
However, reputable online businesses like eBay, strive to keep their audience even if they cannot provide exactly what was needed.
At SiteGround, if you don’t have a custom 404 page for your website, our 404-Not Found page will show up.
How to Fix WordPress HTTP 404 Error – Video Guide
How to Fix the Error 404 Not Found
Let’s say that you are looking for a particular product or post on a site and stumbling on an error 404 instead of getting what you need. As a visitor, you can try a few things on your end to see if that will fix the error.
- Refresh the page – Browsers may temporarily display a 404 Not Found due to some connectivity issues. Therefore, you should try refreshing the page with the F5 or Cmd + R key (on Mac) and see if that solves it. Chances are that the error was just a momentary one, and after reloading the page, all will be in place.
- Flush your browser cache – If you can reach this website normally from other devices, this current device may be having caching issues. Occasionally, browsers may store an outdated cache of a previous 404 response, and flushing it may help fix the error.
- Double-check the URL – You should check if you are typing the URL correctly, as even if one character is mistyped, you will be served an HTTP Error 404.
- Use the site’s search feature – In case you are convinced the website you are browsing holds the information you need, you may also use the search functionality to try different combinations. Chances are that all is in there, and only the keywords you used were inaccurate.
- Contact the website – As a last resort, you may also contact the website directly and check with the administrators for more information. Alternatively, you may check the brand’s social media channels like Twitter to see if there is any news on the subject.
Provided that you manage a WordPress site and the 404 Not Found is preventing access to it, there are several weak spots you can focus on. You can generally fix site-wide 404 errors, by following the steps outlined below.
Attend to a Broken .htaccess file
- Regenerate the .htaccess using the Permalink settings in your WordPress Dashboard
The easiest way to regenerate the .htaccess file for your WordPress website is to use the Permalink page in your Dashboard, as long as you have access to it. After you log into your WordPress Dashboard, navigate to General > Permalinks from the sidebar and simply hit the Save changes button (without actually making any changes).
This action will regenerate your .htaccess, and if this is the culprit, the error 404 should be resolved after a refresh.
- Manually regenerate the .htaccess for your site from File Manager
In case your Dashboard is inaccessible, you can manually regenerate the .htaccess using your File Manager.
To do that, navigate to the respective Site Tools for your website and go for Site > File Manager. Locate the .htaccess file in the website’s public_html folder and click twice to open it for editing.
Once you have opened your file, replace its content with the code below and Save the changes:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Try reloading the page afterward and see if the error 404 is gone, if not – keep reading to learn what else you can do.
Check for Broken .htaccess due to SEF/SEO functionality
Quite often, when custom URL settings are enabled, new rules are added to your .htaccess. If your configuration is not properly done, the new rules can break the .htaccess file, and that results in 404 errors.
If you have recently enabled search engine-friendly URLs (SEF) in your application and you started seeing 404 errors shortly after that, you may need to revise your setup. To do that, go to the Permalinks page in your WordPress Dashboard. When in there, select from several predefined options or set a custom structure for your links.
Alternatively, make sure that your .htaccess file in your WordPress’s main directory has the following rules:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Examine your site for Missing assets – files or URLs
Your site may return a 404 error if you’re trying to reach a file that is not at the address you’re opening. Usually, all files that are supposed to be openable and downloadable are placed within the public_html folder of your site.
To make sure that the file you’re trying to reach is actually in its right place, review the content of the public_html folder. You can do this in your File Manager at Site Tools > Site > File Manager. For WordPress sites, the image files are usually stored in the wp-content/uploads folder.
If you find out that the file you’re trying to reach is not in the public_html folder, you can simply upload it. You can do that by using the Upload icon in the File Manager or just drag and drop the file into it.
Furthermore, if you have deleted a post or a page recently, you should set up a 301 Redirect for it to another page with relevant content. The same applies to posts for which you changed the URL slug – you should set a redirect from the old URL to the new one. In that manner, you will keep your audience engaged with your content and reduce the bounce rate.
Restore from a backup
As a last resort, you may try fixing the WordPress errors by restoring your site from a backup. This may help you recover any missing assets or content from your site. Thus, if that is the culprit, a backup restore could resolve the 404 error you are struggling with.
What are the causes of HTTP 404 Errors?
In general, a 404 Error happens when several possible scenarios are at hand:
- Moved or Deleted Page
- Incorrect URL
- Caching issues
- Missing assets
- DNS issues
Let’s take a more detailed look at the causes:
-
Moved or Deleted page
Imagine that you created a post once; however, later on, you decided to change the URL slug to get a better SEO score. Yet, you forgot to redirect the old URL to the new one. Thus, when visitors search for the page with its previous name, they will be served an error page 404. The same happens when you have deleted a page or a post you do not want/need on your website anymore.
-
Incorrect URL
It is also common to simply type the wrong URL in the browser. If that is the case, the web server will respond with a 404 error message for the requested page. Another possibility is that the page was not linked correctly or the URL was designed with typos. Therefore, make sure to double-check the URL you are trying to use to rule out a typo.
-
Caching issues
At times, due to an outdated browser cache, you may see a 404 response code while the actual page is accessible on other devices.
If an image, CSS, or JavaScript file is missing, the browser will also throw a 404 status code for it, as it can not locate it on the web server.
-
DNS issues
In case you have just recently moved your site to another hosting provider, you’ve most likely pointed the domain’s DNS records to the new server. When that happens, the domain name goes into the so-called propagation period, which may take up to 72 hours. During that time, all sorts of errors may come up on your website (including an error 404) until the DNS changes settle globally.
For example, you may search for a page; however, the browser is still looking for it on the old server. On that occasion, the server will respond with a 404 error as it can not locate the resource.
Can HTTP 404 Errors Damage a Website’s SEO?
Search Engines like Google, Bing, and Yandex use sophisticated algorithms to monitor website visitors’ behavior. How a user interacts with your site affects a large part of your SEO ranking.
If a visitor comes to your website only to be faced with a 404 Page Not Found Error, they will most likely close the tab or click the Go Back button in the browser. This means that the user spent a short time and no cash on your site, as the search result does not match the user’s intent.
Google will consider it a negative user experience and account for it in your overall bounce rate. The bounce rate is one of the most important factors in building an SEO-friendly website. For instance, if your site generates a high bounce rate, Google will show your page lower in the Search Engine Results Pages (SERPs).
To avoid the negative effects of the 404 error, you should regularly inspect your site for broken links. It is highly important to either correct them or redirect them to other relevant pages.
How to Detect and Track Down 404 Broken Links?
It is highly important to detect any broken links on your website and attend to them. For instance, if you delete a post, it is best to set up a redirect toward another relevant page to retain the traffic within your website. This way, you may keep the SEO benefits of the link juice from quality backlinks (incoming links) to the post you deleted.
However, if there is no other relevant page to redirect the deleted one to, you may keep it as it is and strip all internal links pointing to it.
In case there are outgoing links from your site responding with a 404 error message, you should revise and correct them. By fixing such outgoing links you will improve your site’s crawl budget, preventing the search engine from crawling non-existing pages.
There are many web tools you can use for broken link detection. They offer flexible functionalities which we will outline below:
- You can use the Google Search Console tool to track 404 errors on your site if it is verified with Google. After you log into your Google Search Console account, navigate to Settings > Crawl Stats > Not Found (404) to check the list with all URLs returning 404 error codes. When you have all of them identified, you should take the necessary steps to set up redirects for removed content. You should also take care of any dead outgoing links reported by Google Search Console.
- Another popular web-based tool for tracking broken links is the Dead Link Checker. By submitting your site’s URL to it, the tool will crawl through your website, identifying any dead links. The checker provides free manual checks as well as premium subscriptions for automatic check-ups with reports.
- Another great tool to use is the Free Broken Link Checker by Ahrefs. This Checker scans your site for dead links and gives you the option to schedule daily, weekly, or monthly crawls.
- For WordPress sites, you can use a plugin like the Yoast SEO Premium which automatically detects changes in URLs and sets a redirect towards the new URL slug.
- Last but not least, you may turn to the Redirection plugin for WordPress to configure redirects for any broken links and manage them more efficiently.
How to Create a Custom “Error 404 Not Found” Page
More often than not, if you request a source, expecting certain content, and get an error 404 instead, you search for it elsewhere. Similarly, your visitors may feel discouraged from interacting with your site if they are not finding what they need. Therefore, creating a custom 404 Not Found Page is a good strategy to mitigate the damage done by missing resources on your site.
Additionally, we also advise you to customize the page, including your site’s search functionality, a link to your home page, or even links relevant to the initial search content. You should also ensure your personalized 404 Not Found page matches your site’s design. That approach would help reap some potential of a missing asset and provide flexibility to your visitors.
Moreover, taking the time to create your own 404 page will keep the interest of your audience. This way, you can prevent negative impressions.
With most Content Management Systems (CMS)’ like WordPress, Joomla, and Drupal, there is a 404.html page included in their default themes. Some paid themes like Divi incorporate 404 page templates that you may customize to your preferences.
If your site is based on a custom code or your application does not encompass such a page, you can create one manually. To do that, simply go to the root directory of your site files and create a 404.php file, where you can place your code. To force the webserver to display the contents of your custom 404.php file, paste the following in your .htaccess file and save the changes:
ErrorDocument 404 /index.php?error=404
If you wonder how to create a custom WordPress 404 error page without coding skills or a theme that includes such a template, you should use a plugin for this.
Aside from the custom 404 error page layout, you may also input creativity in the error’s wording. This can turn around dissatisfied clients and keep them longer on your site, improving your bounce rate.
Conclusion
The 404 Not Found Error means that some content is missing. Another reason could be that there are configuration issues on the website. Unattended for too long, this type of error may harm your SEO score and impact your business. Thus, it is worth trying to fix a 404 using the tips in this article.
In terms of prevention, it’s good to frequently inspect your site for broken links and correct or redirect them if such are reported. Also, creating a custom 404 error page for your site could potentially keep your visitors browsing.