How to fix error 404 not found

How to fix error 404 not found

Error 404 is an HTTP status code indicating that the server can’t find a web page. Usually, this happens when the URL is incorrect or the page has been deleted or moved.

For website owners, having frequent 404 errors can disengage visitors, leading to a poor user experience. Additionally, these issues can negatively impact your site’s search engine optimization (SEO) by affecting crawling and indexing.

This article will explain the main causes behind the 404 error not found message. We’ll also offer simple methods to fix the problem and show you how to check if your website has any 404 errors.

Download comprehensive HTTP status codes cheat sheet

What causes the 404 error?

A 404 error code typically occurs when the web server can’t find the requested page. Here are the most common reasons why it happens:

  • Mistyped URL. Simple spelling mistakes in the URL prevent the server from finding the intended page.
  • Moved or deleted page. When a website owner deletes or moves a page without setting up a proper redirect, visitors will encounter a 404 error.
  • DNS issues. If the domain name isn’t correctly pointed to the server, the system will fail to locate the requested resource.
  • Broken or dead links. Whether internal or external, linked content that points to a non-existent page can trigger a 404 error.
  • File permissions. Incorrect file permissions can block access to specific web pages, resulting in an error.
  • Corrupted .htaccess file. A misconfigured or corrupted .htaccess file can also cause 404 errors.

How to fix error 404 not found

From restarting the web browser to restoring backup files, this section will explain how to fix 404 error messages. Note that the first method is for end-users, while the other steps are for website owners and administrators.

1. Perform basic troubleshooting

Sometimes, it only takes a quick fix to solve error 404. For visitors, we suggest trying these simple troubleshooting steps to identify whether the issue lies with your browser or device:

  • Restart browser. Close and reopen the browser to reload the page, as this can refresh the connection and resolve the problem.
  • Clear cache and cookies. Clear your browser cache, cookies, and history to ensure outdated or corrupted data isn’t causing the error page to appear.
  • Check for typos. Double-check the URL for spelling mistakes or missing characters that could prevent the server from locating the specific page.
  • Use another device. Access the website from a different device – maybe the 404 page not found error affects only one device or session.
  • Switch to incognito. Use an incognito or private browsing window, which doesn’t store cache or cookies, to see if a fresh session resolves the issue.

If the issue persists, inform the website owner or someone responsible for the site you’re trying to visit. Look for contact information on the site’s Contact Us page or footer area and let them know about the issue.

2. Use Hostinger AI Troubleshooter

If you host your WordPress site on Hostinger, try our AI Troubleshooter to detect and resolve 404 errors automatically. This tool identifies the root cause and provides tailored solutions to fix the issue.

Here’s how to use Hostinger’s AI Troubleshooter:

  1. Log in to hPanel and navigate to Websites → Dashboard.
  1. In your dashboard’s left sidebar, go to WordPress → AI Troubleshooter.
  2. The tool will automatically scan your website for errors. If it detects a 404 error, AI Troubleshooter will provide details on when the error occurred and check the server, error logs, and website files.
  3. Once the scan is complete, the tool will suggest actions to take. You can apply the fixes yourself or let the tool resolve the problem by clicking the Fix my website button.
  1. After that, check your website to confirm the issue has been resolved. If the problem persists, hit Try another solution for alternative fixes.

3. Check domain DNS settings

When your domain isn’t correctly pointed to the hosting server, it can result in a 404 response code. DNS settings control how your domain connects to the server, and even a minor misconfiguration can cause the requested domain name to be inaccessible.

To resolve this issue, verify that the DNS configurations are correct. If your domain and hosting are with Hostinger, the domain will automatically point to the correct hosting server.

However, if you own a hosting plan from Hostinger but use a domain from another provider, follow these steps:

  1. Go to hPanel → Websites → Dashboard → Hosting Plan → Plan Details.
  1. In the Website Details section, you’ll find your hosting account’s IP address. Similarly, check the Nameservers section to write down the correct nameservers.
  1. Open your domain provider’s control panel and update the DNS settings with the correct information to resolve the error.
  2. Once done, wait for the DNS to propagate, which can take up to 24 hours. Periodically check the status using online tools like DNS Checker, DNSMap, or whatsmydns.net.

4. Fix file permissions

File and folder permissions control who can access, edit, or run the data on your hosting account. When these settings are incorrect, the server may block access to certain pages, leading to error 404.

For Hostinger customers, here are the steps to reset file permissions in hPanel:

  1. Go to Websites → Dashboard → Advanced → Fix File Ownership.
  2. Check the box to confirm that you want to reset the file permissions to default.
  3. Hit Execute.

Important! Hostinger’s default permissions are set to 644 for files, meaning the owner can read and write, while others can only read. For folders, it’s 755, which allows the owner to read, write, and execute and others to only read and execute.

Hostinger web hosting banner

If you want more control over file or folder permissions, you can set them manually in the file manager. Here’s how:

  1. Access your hosting provider’s file manager and open the public_html directory where your website files are stored.
  2. Right-click the file or folder and select Permissions or a similar option.
  1. Adjust permissions accordingly by ticking the appropriate boxes.
  1. Once done, save your changes.

5. Disable and recreate the .htaccess file

A corrupted or misconfigured .htaccess file can cause a 404 error, so consider disabling it and recreating a new one to resolve the issue. .htaccess manages URL redirections, access control, and various website functionalities. When this file breaks, it can lead to page not found issues.

Follow these instructions to disable and recreate the .htaccess file:

  1. Navigate to the public_html directory via your hosting’s file manager.
  2. Right-click the .htaccess file and choose Rename.
  1. Give it a new name to disable it, such as .htaccess_old, then save the changes.
  2. Click New File and name it .htaccess.
  1. Copy and paste the code below into the new file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

For WordPress sites, use the following code snippets instead:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  1. Once done, hit the Save button.

6. Restore backup files

If some of your website pages have been deleted or corrupted, restoring a backup can help recover lost content and resolve 404 errors. This method is beneficial when external links redirect visitors to missing pages.

Note that the exact steps depend on how you previously backed up your site. Here’s how to do it in Hostinger’s hPanel:

  1. Go to Websites Dashboard and choose Files → Backups.
  2. To fully restore the website, click Select under the Restore website option.
  1. Choose your preferred backup date from the available options and hit Restore.
  1. Alternatively, if you want to restore specific files or folders, choose File Backups instead.
  2. Select a backup date and click Next Step.
  1. Select the files or folders you want to restore. You can choose multiple items by checking the boxes next to each one.
  2. Once selected, click Restore files.

How to check for 404 errors on your website

It’s important to regularly check for 404 errors to keep your website running smoothly and avoid frustrating visitors. Below are several methods to help identify and address these issues properly.

Google Search Console

Google Search Console (GSC) offers valuable features to monitor and maintain your website’s health. You can go to Indexing → Pages and select Not found (404) under the Why pages aren’t indexed section to see a list of pages that trigger 404 errors.

Alternatively, enter the URL you want to check into the search bar at the top. The tool will show whether the URL is indexed or returns a 404 error. After fixing the issue on your website, you can ask Google to reindex the page.

Link checker tools

Tools like Screaming Frog and Ahrefs’ Broken Link Checker are excellent for finding 404 errors. These tools scan your domain to detect errors or broken pages, so you can correct them before they affect user experience or search engine performance.

Manual checks

While automated tools are helpful, manual checks provide a more hands-on approach. Regularly review your website’s internal links to ensure they direct users to the correct pages.

Additionally, consider user-reported errors, as visitors may uncover 404 errors that automated scans missed or find pages that these tools haven’t indexed.

Why fixing 404 errors is crucial for SEO

Addressing error 404 is necessary to preserve your website’s SEO performance. Here’s why fixing this issue matters:

User experience

404 errors can discourage visitors, leading to higher bounce rates and reduced engagement. Users will likely leave your website and seek information elsewhere when they encounter broken pages. This signals search engines that your website doesn’t provide a good user experience.

Crawling and indexing

Search engines like Google rely on crawling to discover and index content on your website. Frequent website 404 error messages can interfere with the process. As a result, your pages may be left out of search engine results pages (SERPs) or even lead to potential penalties, impacting your site’s visibility.

Lnk equity

Broken links cause link equity loss, affecting your site’s SEO. Backlinks from other websites that lead to 404 error pages lose their SEO value. Over time, this can diminish your site’s authority and reduce its ranking potential in search results.

Conclusion

Addressing 404 errors is crucial for maintaining a positive user experience and ensuring good SEO health on your website. When users encounter broken links, they may leave your website, leading to increased bounce rates and decreased search engine rankings.

Conducting regular website audits helps identify and fix issues before they affect your visitors. You can use tools like Google Search Console to monitor 404 errors and other potential problems, enabling you to resolve them quickly.

By prioritizing these actions, you enhance your website’s usability and search visibility, ultimately contributing to a more successful online presence.

Error 404 FAQ

What is error 404?

Error 404, also known as 404 not found, is an HTTP status code that appears when the server can’t find the requested resource. This typically happens when a user attempts to access a page that has been deleted, moved, or never existed.

How can I prevent 404 errors in the future?

To prevent 404 errors, periodically audit your website for broken links, ensure all URLs are correctly configured, and use 301 redirects for any moved pages. Additionally, tools like Google Search Console let you proactively monitor and address potential issues.

Should I customize the 404 pages on my website?

Yes, we recommend customizing your 404 pages. A well-designed custom error 404 page can guide users to relevant content, enhancing their experience. Add a search bar, helpful links, or a friendly message to engage visitors.

Author
The author

Ariffud Muhammad

Ariffud is a Technical Content Writer with an educational background in Informatics. He has extensive expertise in Linux and VPS, authoring over 200 articles on server management and web development. Follow him on LinkedIn.