Connect with us

Guides and Tutorials

How to Fix Error 404 Not Found On WordPress Posts and Pages

Published

on

How to Fix Error 404 Not Found On WordPress Posts and Pages


Struggling with how to fix the 404 Not Found error on WordPress posts and pages?

This error might appear sometimes when you, or a visitor, try to access a certain page on your site. Instead of seeing the content that you expected, you see something like an “Error 404 Not Found” message instead.

Thankfully, this error message is usually localized to the specific page in question. That is, it shouldn’t affect any other parts of your site (though it can in rare cases).

However, that doesn’t mean it’s not frustrating, and you’ll definitely want to do your best to prevent and fix 404 errors on your site.

In this post, we’ll cover everything that you need to know about 404 errors including:

  • What the 404 Not Found error is and what causes it
  • Fixing sitewide 404 errors on WordPress
  • Fixing individual 404 errors on WordPress
  • Monitoring your site for 404 errors
  • Creating a custom 404 page for your site (this will make more sense after you’ve read the other sections!)

What Is Error 404 Not Found?

The Error 404 Not Found message appears when you, or one of your visitors, tries to visit a page on your site that doesn’t exist.

That could be either because the page never existed, the page was removed (deleted), or the page’s URL was changed to a different URL.

For example, let’s say you have a blog post at yoursite.com/2020-guide. If you update the post for 2021 and change the URL to yoursite.com/2021-guide, then anyone who tried to visit the original 2020-guide URL would see a 404 error because that page no longer exists at that URL (unless you set up a redirect – more on that later!).

Most of the time, the error only appears when a person tries to visit a nonexistent URL on your site. That is, the error won’t affect any content that does exist.

In rare situations, however, a corrupted .htaccess file can cause the 404 error to appear on your entire site.

404 Error Variations

The 404 Error Not Found message can appear in several different variations depending on what web hosting/web server you’re using, the browser that a visitor is using, and how your site is configured.

Here are some common variations:

  • “Error 404”
  • “404 Not Found”
  • “Not Found”
  • “Page Not Found”
  • “The requested URL was not found on this server.”
  • “HTTP Error 404”
  • “We can’t find the page you’re looking for.”
  • “The page cannot be found”

To add some further complexity, it’s actually possible to create your own custom 404 message that will appear whenever there’s a 404 error on your site.

We’ll cover this topic in more depth later on, but this lets you create a more user-friendly error message and help redirect users to the right spot.

For example, on the Astra website, we have a custom 404 page that includes a search box to help users find the content that they’re looking for:

Custom 404 error page Astra

This is actually the default 404 error page for all sites using the Astra theme, though Astra makes it easy to create your own custom design – more on that later too.

Some websites even use their 404 pages as a way to show some creativity, like this 404 page from Ready to Go Survival:

Custom 404 error page 2

What Causes Error 404 Not Found?

There are two types of 404 errors that you might be experiencing and the likely cause depends on which type of error it is.

We’ll include fixes for both types of problems below.

If you see a sitewide 404 Not Found error no matter what page you try to visit, the issue is likely with your WordPress site’s permalink structure or .htaccess file.

Something got corrupted somewhere which is causing your site’s server to think your site’s URLs don’t exist. It sounds serious, but this one is usually pretty easy to fix so don’t worry.

On the other hand, if you only see the 404 Not Found error on specific URLs (but the rest of your site works), then there are several potential problems:

  • Broken links – Someone might be linking to a page on your site that doesn’t exist. This could be an external link on someone else’s site or an internal link on your own site. When people click the link, it takes them to a page that doesn’t exist and triggers the 404 error.
  • Changed URLs – If you change the URL of a piece of content, you might have people still trying to visit the old URL which will trigger a 404 error (unless you set up a redirect).
  • Typos – Someone might have accidentally mistyped the URL that they’re trying to visit.

It’s impossible to fix all of these causes because you can’t prevent someone from making a typo.

But you can fix broken links and changed URLs, and you can create a custom 404 page to create a more user-friendly experience for users who make typos.

Why You Need to Fix Error 404 Not Found?

The 404 error can be problematic for a couple of reasons.

The biggest reason is that it’s just plain frustrating for your visitors. They’re trying to access a certain piece of content. Instead of seeing the content they expected, they’re seeing a 404 error instead.

For this reason alone, you should always try to fix 404 errors on your site.

Beyond creating a poor user experience, 404 errors can also be an indirect drag on search engine optimization (SEO). If the 404 error is a result of a broken internal or external link, you might be wasting link equity.

Basically, Google ranks a page in part on how many links point to it. So if a link points to a missing page instead of the actual URL, you’re essentially missing out on the benefit of that link.

Some SEO experts also claim that 404 errors can make it harder for Google to crawl your site, though Google says this isn’t an issue.

How to Fix Sitewide 404 Not Found Errors in WordPress

If you’re seeing the Error 404 Not Found message across your entire WordPress site, you should be able to fix the problem by regenerating your site’s .htaccess file or permalinks.

If you can still access your WordPress dashboard, you can do this directly from your dashboard. Otherwise, you might need to connect to your server using FTP.

Assuming you still have dashboard access, all you need to do is go to Settings → Permalinks in your dashboard.

Then, just click the Save Changes button.

There’s no need to make any other changes – just clicking Save Changes will force WordPress to generate a new .htaccess file, which should fix the problem:

fix sitewide 404 errors

If you can’t access your WordPress dashboard, you’ll first need to connect to your site’s server using FTP with a tool like FileZilla (tutorial here).

Then, delete the existing .htaccess file. We recommend downloading a copy of the file first so that you have a backup just in case.

Once you delete the .htaccess file, you should be able to access your WordPress dashboard and you can generate a new .htaccess file by going to Settings → Permalinks and clicking Save Changes.

How to Fix Individual 404 Errors on WordPress

If you’re experiencing 404 errors on specific pieces of content, you’ll need a more targeted approach to fix the problem.

There are two tactics that you can try:

  1. Fix any broken links on your site to make sure you’re not accidentally sending visitors to content that doesn’t exist.
  2. For remaining errors, you can set up redirects to automatically send people to the correct URL(s) instead of showing a 404 error.

How to Find and Fix Broken Links

The first step in stopping 404 errors is to make sure you don’t have any broken links on your site that send users to a 404 error.

To quickly scan your site for broken links, you can use the free Broken Link Checker plugin.

Once you install and activate the plugin, go to Tools → Broken Links to view a report.

If the plugin detects a broken link, you can fix it directly from the plugin’s interface:

broken link check

Note – while this plugin is useful, we recommend deactivating it once you’re finished to reduce any performance impact from the plugin’s scanning.

How to Set Up Redirects

For any remaining 404 errors, you can fix the problem by manually setting up a redirect to send users to the correct page.

Let’s go back to that example from before where you had a blog post published at yoursite.com/2020-guide and then you updated it for 2021 and changed the URL to yoursite.com/2021-guide.

To prevent people from seeing a 404 error when they visit yoursite.com/2020-guide, you can set up a redirect that automatically redirects the people who visit yoursite.com/2020-guide to yoursite.com/2021-guide.

There are several plugins that make it easy to set up redirects on WordPress, but we recommend the popular and free Redirection plugin.

All you do is enter the original URL and the new destination URL and the plugin will handle everything else for you:

create redirection

To learn more about what redirects are and how to use them, we have a complete guide on WordPress redirects.

How to Monitor Your WordPress Site for 404 Errors

If you want to proactively prevent 404 errors on your site, it can be useful to monitor which URLs are triggering them. Then, if you see that a particular URL is causing problems, you can step in and set up a redirect to send users to the proper spot.

There are a few ways that you can track the URLs that are triggering 404 errors:

  • Google Analytics
  • Google Search Console
  • The Redirection plugin

Google Analytics

If you’re using Google Analytics, you can use its built-in reporting to check for URLs that caused 404 errors.

To get started, go to Behavior → Site Content → All Pages and then search for “Page Not Found” with Page Title as the primary dimension:

google analytics 404

You can then click on the result to see the specific URLs that caused the error:

google analytics 404 url

In this example, you can see that yoursite.com/page-that-doesnt-exist was the URL that triggered the 404 error. You can use this information to set up a redirect.

If you’re not using Google Analytics yet, you can follow our guide to add Google Analytics to WordPress or browse the best Google Analytics plugins.

Google Search Console

Google Search Console is another useful way to track 404 errors. Unlike Google Analytics, which tracks the 404 errors that your human visitors encounter, Google Search Console will show the 404 errors that Google’s web crawler bot encounters.

Typically, these errors are the result of broken links, either on your own site or someone else’s site. Or, it could be an issue with your sitemap including content that doesn’t exist.

To look for 404 errors, go to the Coverage report and check for 404 errors in the Type column:

404 errors google search console

Redirection Plugin

For a native WordPress solution to track 404 errors, you can use the free Redirection plugin that we mentioned above. It helps you both track 404 errors and then easily set up redirects for any problems that it finds.

In the setup wizard, make sure to enable the 404 logging feature. Beyond that, there’s nothing else to configure.

You can view a log of 404 errors by going to Tools → Redirection → 404s. If you hover over an error, the plugin will give you an option to set up a redirect right away:

redirection plugin 404 error log

How to Create a Custom 404 Error Page

As we mentioned earlier, another way to lessen the impact of 404 errors is to create your own custom 404 page. You can use your custom 404 page to…

  1. Explain the error and why the visitor isn’t seeing the content that they expected to find.
  2. Include a search box.
  3. Offer some relevant links to your most popular content/features.

There are lots of different ways that you can create a custom 404 page on WordPress – we’ll share three code-free methods.

Astra Theme

If you’re using the Astra theme, you can use Astra’s built-in Custom Layouts feature, which is available in Astra Pro.

Once you activate the Custom Layouts module, you can go to Appearance → Astra Options → Custom Layouts.

Make sure to set the layout as the 404 page and then you can use the native WordPress editor or your favorite page builder to design the 404 page:

astra pro 404 page custom

For a more detailed look, you can follow our guide on how to create a custom 404 page with Astra Custom Layouts.

Elementor Pro

If you’re using Elementor Pro (our review), you can use Elementor Theme Builder to design a custom 404 page template:

Elementor 404 custom page

To learn how to use the Elementor interface, you can follow our Elementor tutorial.

404page

For a free option to create a custom 404 page, you can use the 404page plugin.

To get started, create the design that you want to use for your 404 page using a regular WordPress page (Pages → Add New). You can use the regular WordPress editor or your favorite page builder.

Once you’ve done that, go to Appearance → 404 Error Page and use the drop-down to select the page that you just created:

404page plugin WordPress

That’s it! People who experience a 404 error will now see that page.

Fix the WordPress 404 Not Found Error Today

The Error 404 Not Found message can be frustrating for WordPress users. But with the tactics in this post, you can easily fix your site’s 404 errors and prevent 404 errors in the future.

Beyond that, you can also create your own custom 404 error page that lessens the impact of errors by providing an explanation of what’s going wrong and helping visitors find the content that they’re looking for.

Do you still have any questions about the Error 404 Not Found message on WordPress? Let us know in the comments!





Source link

Continue Reading
Click to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.