Wordpress

How to fix 404 errors on WordPress: Understand, solve and monitor

Published:

Last updated:

the screenshot of code when 404 error happens
Home » Articles » Wordpress » How to fix 404 errors on WordPress: Understand, solve and monitor

If you’re checking your website and you spot some 404 errors, don’t panic. Overall, your website is still fine. 404 errors are common affecting all websites big and small. What you need to do is fix it as soon as possible to avoid causing a poor experience for your site visitors and hurting your search engine rankings.

What is a 404 error?

A 404 error is a common issue with WordPress. It occurs when a web page requested is not found by the browser. How exactly the error shows will depend on how your WordPress website is configured, please note that the, the 404 error message can appear in various formats, including:

  • 404 errors.
  • 404 Not Found.
  • HTTP 404 errors.
  • Not Found.
  • Page Not Found.

The cause of 404 errors

Before knowing how to fix 404 errors on WordPress, you should know 404 Errors can be caused by:

  • Incorrect URL entry: web owner input wrong URLs, often due to typos.
  • Caching issues: Browsers may cache dysfunctional pages, leading to persistent 404 errors.
  • DNS setup problems: Newly registered or redirected domains may show errors due to incomplete DNS propagation.
  • WordPress compatibility issues: Plugins or themes can impact URL generation, causing 404 errors with outdated URLs.
  • Resource deletion: Removed resources are no longer available on the server.
  • URL changes: Altered URLs linking to resources can trigger 404 errors.
  • Misconfiguration: Website misconfigurations can prevent the server from locating resources.

Understand soft 404 errors

A soft 404 error occurs when a URL returns a message indicating that the page is not found while also providing a 200 (success) status code. This error type is not a typical server status code; instead, it serves as a marker for search engines to assess these pages and determine whether they should be disregarded. Sometimes, such pages may lack substantial content or be entirely empty, often arising due to various factors within your website’s server, content management system, or even the user’s web browser.

Potential reasons for encountering a soft 404 error include:

– A missing server-side include file.

– A malfunctioning database connection.

– An empty internal search results page.

– An unloaded or missing JavaScript file.

Returning a 200 (success) status code while presenting or hinting at an error message on the page can lead to a negative user experience. Users might assume the page is functional only to be confronted with an error, ultimately resulting in their exclusion from search results.

When Google’s algorithms detect that a page is deemed an error page based on its content, Search Console will highlight a soft 404 error in the site’s Page Indexing report.

How to identify 404 errors? 

You can identify 404 errors by manually clicking on links to check their status, but this can be time-consuming and not recommended. We recommend applying two different approaches, one to check your current website immediately (with W3 Link Checker), and the other to keep an eye on your website and monitor any new errors (Google Search Console).

The free W3 Link Checker looks for issues in links, anchors and referenced objects in a Web page, CSS style sheet, or recursively on a whole Web site. It browses your website and checks for any links which return a 404 error. For most sites the test is completed in under 20 minutes. From the resulting list you can check those pages inside WordPress and fix the broken links. Either by removing the link entirely or updating it to point to a relevant and working page.

Monitor your site for 404 errors: Google Search Console

GSC, a free Google tool. It helps you understand and assess how your website is performing in Google Search. As part of this it also assists in identifying and resolving 404 error issues. Here’s how:  

1. Open your Google Search Console. If not set up, follow Google’s setup instructions.

2. In the GSC dashboard, find the Page section in the menu.

3. Locate “Page indexing” on the right side.

4. Check “Why pages aren’t indexed”.

5. Navigate to the “not found 404” section to view pages with 404 errors problems.

You can take a list from here and start to identify pages which may need to be fixed.

How do 404 errors affect your website? 

Having numerous 404 errors can significantly impact two crucial areas: user experience and SEO.

User Experience

404 errors disrupt the visitor’s journey on your website, leading to frustration when desired content is inaccessible. This can prompt users to seek information elsewhere, potentially damaging your brand’s reputation. Users unfamiliar with website intricacies may interpret 404 errors as a sign of low quality or malicious intent, adversely affecting brand perception.

SEO

When Google encounters a page with a 404 error while crawling, it refuses to index the page, resulting in exclusion from search results. This absence from Google’s database diminishes site visibility and traffic. Furthermore, the presence of “dead” backlinks—those leading to 404 errors pages—can signal low site authority or credibility to Google, further harming SEO efforts.

How to fix 404 errors on WordPress? 

Based on the cause of 404 errors issue, we will have specific way to fix it

Incorrect URL Entry

This is a very silly mistake stemming from a quick typo and failure to double-check the link entry. However, if this is the cause, you can easily rectify it. All you need to do is simply recheck and correct any typos in the URLs within your WordPress posts, pages, or navigation menus and then publish your changes.

how to fix wrong url in wordpress

(It should be sketch.com, not skretch.com) 

Theme issues

Sometimes third party plugins, themes, or code snippets added to your WordPress site can interfere with permalinks or cause conflicts which lead to 404 errors. You are most likely to run into this issue if you are using some plugins which have similar functionality, for example if you were using two LMS plugins on your website which both shared a resource name such as “courses” or “lessons”. 

If you are having issues with your theme or plugin you can try these steps. Ideally you would complete this on a staging or development version of the site. If that’s not possible it would be advised to complete this during a low traffic time to avoid causing disruption.

  1. Backup your website.
  2. Deactivate each plugin one by one, starting with the most recently installed or updated.
  3. After deactivating each plugin, check if the 404 error persists.
  4. If the error disappears after deactivating a specific plugin, you’ve identified the culprit – you can now isolate this plugin for further investigation..
  5. Reactivate the remaining plugins.
  6. Consider your need for the plugin. Can you get the same functionality from existing plugins or from the native features of WordPress and your theme? If so, consider dropping this plugin from your list. Otherwise you may need to contact the plugin developers for support or raise this with your developers.

Caching Issues

Caching issues in WordPress can trigger 404 errors by displaying old versions of web pages stored in the cache, resulting in missing or inaccessible content on the site.

Clear your browser cache to ensure you are loading the most recent version of the web page.

Without plugin

  1. Ensure your site has a plan with plugins enabled.
  2. For lower-level plans, the cache is automatically flushed periodically on your site. It is not possible to manually clear the site’s cache, and there is no need to do so.
  3. Access your site’s dashboard.
  4. Go to Settings → Hosting Configuration (if using Default View) or Hosting → Configuration (if using WP-Admin).
  5. Scroll down to the Cache section:
  6. The Cache panel with the Clear Cache button displayed.
  7. Click the “Clear cache” button to initiate the process.
  8. Wait briefly until you see the message “WordPress cache cleared successfully.”
  9. Once the cache has been cleared, the “Clear cache” button will be disabled for one minute, and you will be notified with the message “You have recently cleared the cache. Please wait a minute before trying again.”

With plugin

You can consider installing a caching plugin such as WP Super Cache or W3 Total Cache to manage caching settings effectively. However, some plugins may be incompatible with WordPress when clearing cache, so consult with a WordPress expert before taking any action.

Resource Deletion

Resource Deletion can lead to 404 errors in WordPress when essential files or assets linked to a web page are removed or deleted from the server. This results in the server being unable to locate the necessary resources, causing the webpage to display a 404 error indicating that the requested content is not found.

Restore from Backup

If you have a backup of your WordPress site that includes the deleted resources, you can restore them from the backup. 

Re-upload from WordPress Dashboard

For pages/posts: Navigate to Post/All Posts or Pages/All Pages -> Trash to verify if the deleted content is still present and restore it.

How to fix 404 errors on WordPress by applying redirect 301 url 

Another approach is to update any internal links pointing to these resources to avoid 404 errors, utilizing a 301 redirect. Redirect 301 (Moved permanently) is an HTTP status code used to indicate that URLs or web pages have been permanently redirected to another URL or web page. This means that all values of the original website or URL, such as images, content, etc., will be transferred to the new URL.

If the 404 Not Found error occurs only with some posts/pages, the reason may be that the post/page URL slug has been changed. When users try to access the old post, instead of the desired resource content, they will encounter a 404 Error.

The best solution to this issue is to redirect users from the old location to the new one. This way, visitors will get the desired content without encountering a 404 error. This method is also very SEO-friendly.

You can install and activate the Redirection plugin which is the easiest and fastest way to do this. In the dashboard, go to the “Add New Redirection” section, then set up as follows:

  • Source URL: Enter the URL that is encountering the 404 Not Found error.
  • Target URL: Enter the new URL of the post/page content.
  • Then click the “Add Redirect” button to complete the process.

When a website experiences misconfigurations that lead to the server being unable to locate resources, updating the permalinks can often resolve this issue. 

One common cause of the 404 not found error in WordPress is the way permalinks are generated. When using WordPress, users are provided with various options for configuration, such as post formats, page links, etc. For example, configuring permalinks based on date or setting postname as the URL.

Sometimes after many changes are made, for example new content types are added and plugins or themes are updated, your plugin configuration can end up out of date. You can fix this by accessing the permalinks menu in WordPress and re-saving this page.

To fix Permalinks from the WordPress admin page, follow these steps:

  • Step 1: Go to Settings > Permalinks. Take note of your current WordPress configuration so you can revert to it later, as this change is temporary to set up the Permalinks structure.
  • Step 2: If this is your first time following these steps you can simply click on “save” at the bottom of the page. And then move on to testing your results by visiting the affected pages. If you have already tried this you can try updating your permalinks to the Plain setting under Common Settings > and then click Save. Please note that making big changes to your permalinks can cause other issues with your site structure and potentially lead to more 404 errors. So you should always make a note of your settings first so that you can quickly revert in case this causes more errors.

Finally, open your website to check if the 404 error still appears.

How to fix 404 errors on WordPress by editing .htaccess file 

The .htaccess file in WordPress can cause 404 errors if it contains misconfigured rules related to permalinks or redirects. Incorrect settings within the .htaccess file can lead to the server being unable to locate the requested pages or resources, resulting in the display of 404 errors when users try to access certain content on the website.

To fix the 404 errors on a WordPress site by editing the .htaccess file, the first step is Before making any changes, download a backup copy of your current .htaccess file to ensure you can restore it if something goes wrong. Then follow these steps:

  1. Access your .htaccess file:
    • Login to your web hosting control panel or use an FTP client to access your website files.
    • Look for the .htaccess file in the root directory of your WordPress installation. Make sure you have enabled viewing hidden files.
  2. Correct the Permalink Settings:
    • Go to your WordPress dashboard and navigate to Settings -> Permalinks.
    • Without making any changes, hit the Save button to refresh your site’s permalinks.
  3. Edit the .htaccess file:
    • Open the .htaccess file using a text editor.
    • Add the default WordPress .htaccess rules. These rules should look like:
# 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. Check file permissions:
    • Ensure that your .htaccess file has the correct permissions. Set the permissions to 644 or similar (readable by everyone, writable by the owner).
  2. Save changes and upload:
    • Save the changes you made to the .htaccess file and upload it back to your server.
  3. Clear cache:
    • If you are using any caching plugins or services, clear the cache to ensure that the changes take effect.
  4. Test your site:
    • Visit your website and check if the 404 error has been resolved. Try accessing different pages to verify that the links are working properly.

After following these steps, your WordPress site should no longer display the 404 error. If the issue persists, you may need to investigate further or seek help from your web hosting provider or a WordPress developer.

How to fix 404 errors on WordPress by setting up DNS correctly

A DNS setup problem that can result in 404 errors in WordPress occurs when the domain name system (DNS) is not configured correctly to point to the proper web server hosting the WordPress site. This misconfiguration leads to the inability of the browser to locate the correct server, causing the 404 errors when attempting to access the site.

Sometimes you can get a 404 issue caused by DNS setup problems. Typically this is due to incomplete DNS propagation for newly registered or redirected domains. If you’ve just completed a domain redirect or registration then you may simply need to wait a bit longer for any errors to be resolved. If the error does persist though and you have concerns about the configuration applied we would recommend following these steps:

1. Check DNS Settings:

Verify that the domain name is correctly pointed to the right server IP address in your domain registrar’s DNS settings. Ensure that the DNS records are accurately configured.

2. Confirm Name Servers:

Ensure that the correct name servers are set for your domain and that they are pointing to the hosting provider where your WordPress site is located.

3. Wait for DNS Propagation:

– DNS propagation can take up to 48 hours to complete globally. If you recently registered or redirected the domain, wait for propagation to finish before expecting the domain to resolve correctly.

4. Flush DNS Cache:

– Clear your local DNS cache on your computer to ensure you’re not seeing cached DNS details that could be causing the issue. You can do this by running the appropriate command based on your operating system.

5. Check WordPress Address and Site Address:

– In the WordPress admin dashboard, go to Settings -> General.

– Make sure that both the WordPress Address (URL) and Site Address (URL) reflect the correct domain. Update these settings if needed.

6. Temporary Domain Mapping:

– If DNS propagation is taking longer than expected, consider mapping a temporary domain or accessing your WordPress site using the server’s IP address for testing purposes.

7. Contact Hosting Provider:

– If the issue persists and you’ve ensured correct DNS settings, contact your hosting provider’s support team for assistance in troubleshooting and resolving DNS-related problems impacting your WordPress site.

FAQs

What should I do if I’m still unable to fix the 404 errors?

A: If you’ve tried all the above steps and are still facing issues with 404 errors, consider seeking help from WordPress forums, hiring web retainer service, or contacting WordPress support for further assistance.

Should I have a backup of my website before fixing 404 errors?

A: Yes, it is highly advisable to have a recent backup of your website before attempting to fix 404 errors in WordPress. Backing up your site ensures that you have a copy of your website’s content, database, and configurations in case any issues arise during the troubleshooting process. This backup acts as a safety net to restore your site to a functional state in the event of unintended data loss or complications while addressing the 404 errors. .

How can I prevent 404 errors from happening on my WordPress site?

A: To prevent 404 errors on your WordPress site, consider the following preventive measures:

   – Regularly check for broken links and fix them promptly.

   – Create custom 404 error pages to provide users with helpful information and navigation options.

   – Implement a robust backup system to restore lost content in case of accidental deletions.

   – Keep your WordPress installation, themes, and plugins updated to avoid compatibility issues that may lead to 404 errors.

Are there specific tools or plugins that can help in diagnosing 404 errors in WordPress?

A: Yes, there are several tools and plugins that can assist in diagnosing and fixing 404 errors in WordPress, such as:

   – Yoast SEO: Helps in setting up proper permalinks and managing redirects to prevent 404 errors.

   – Query Monitor: A debugging tool that can help identify issues with plugins or themes causing 404 errors.

How does CDN (Content Delivery Network) configuration relate to 404 errors in WordPress?

A: Improper configuration of your CDN settings, such as caching rules or URL rewriting, can sometimes result in 404 errors pages being served to users. Make sure your CDN is configured correctly to avoid such issues and consult your CDN provider’s documentation for best practices.

Ready to improve your website?

Add Kahunam to your team. We'll help you build a new website that helps you crush your goals. Or we'll take your existing website and help you take it to the next level — leaving your competitors in the dust.