Home Blog WordPress Management How to fix a WordPress 404 page not found error

How to keep a log of 404 errors in WordPress

How to fix a WordPress 404 page not found error

Few website errors are more annoying than the infamous 404 page not found error. A potential site visitor is just browsing online. They click a link on your site, and boom – the page is nowhere to be seen. 

In most cases, your visitor will have clicked through from a search result or an internal link placed on another page. Only, once they land on your page, they find that nothing’s there. 

For potential customers visiting your website for the first time, this doesn’t leave a good first impression.

But the presence of WordPress 404 errors can hurt your site in other ways, too – specifically with regard to SEO. 

Thankfully, there are things you can do to keep WordPress 404 issues at bay. Keeping a log of 404 errors is step one. Doing so will help you spot the errors and deal with them more quickly. But you’ll also be able to:

  • Quickly identify and fix broken links.
  • Improve your website’s search engine performance (SEO).
  • Better identify suspicious behavior such as “fuzzer” scans or website infections.

Clearly, we have a lot to cover. So let’s dive in.

What is a WordPress 404 page not found, exactly?

When you see a 404 error as a site visitor, it could look something like the following:

What this means is that the visitor’s web browser can successfully connect to the website server. But the server can’t find the resource the visitor requested. Think of a specific URL, page, or file. So, the web server responds with an HTTP 404 error code.

What are HTTP status codes?

Your web browser communicates with the remote web server using the HTTP protocol. When you request something from the web server, it responds with a specific status or error code. Each code means something specific.

For example; when a visitor requests a page that exists, your web server replies with HTTP status code 200. This means “success page found”. Your website visitors never see this displayed. Instead, they are simply presented with the resource or content requested.

But when someone tries to access a page that doesn’t exist, your web server responds with an HTTP error code 404. This is an error that signifies an object hasn’t been found. In the case of a missing post or page, a message relaying The 404 error will be displayed to visitors. Again, it might look something like this:

HTTP status codes can be divided into five different categories:

  • 1xx informational: Request received, continuing process
  • 2xx successful: Request received, understood, and accepted
  • 3xx redirection: Further action is required to complete the request (typically some sort of redirection to another URL / resource)
  • 4xx client error: The request cannot be fulfilled or cannot be understood
  • 5xx server error: The request is valid however there was an error processing it

To learn more about all the different HTTP status codes, and to learn what each of them represents, view the complete list of HTTP status codes. These are compiled from the Internet Assigned Numbers Authority.

Why do 404 errors occur on WordPress websites?

There are several reasons why there are 404 errors on your website. However, they are usually related to either one or a combination of the following things.

A WordPress page or post was deleted

A 404 error can be caused by a page/post being deleted and website visitors still trying to access it. Either via a link on another website, another page on your own website, or a search engine.

Missing object or element

Another common problem, especially when there are multiple 404 errors, is a missing object or element on the page.

For example, let’s say you delete an image or a line of code in the footer of your website. Whenever a page on the website is loaded, the bulk of the content may continue to load for visitors. But any missing resources will not. Generating multiple 404 errors on the back end.

Automatic scanning programs

Automated scanning programs also generate numerous 404 errors because they try to guess URLs. For instance, they will often request specific URL patterns. This is to determine if the target website uses a specific system, such as:

  • /wp-admin/
  • /admin/
  • /portal/
  • /dashboard/

Using these programs in this way is called fuzzing. The fuzzing technique works by sending large volumes of random HTTP requests to a site to identify bugs, security loopholes, or weak points in the site’s infrastructure. Bad actors use these techniques to look for paths that may expose vulnerabilities, like administrative pages or sensitive directories.

When you notice a spike in unexplained 404 errors — especially for URLs like the ones above — it’s often a sign that someone may be “fuzzing” your website. This activity could indicate that bad actors are probing your site for potential entry points. Or, they’re trying to uncover hidden admin panels or paths that could give them unauthorized access.

Note: Search engine crawlers can also contribute to a similar pattern of 404 errors. While they aren’t using fuzzing techniques, they may attempt to crawl URLs that don’t exist due to links pointing to these pages or crawlable search features. This can sometimes look similar in your logs, although the types of URLs are often different.

Why 404 errors can hurt your site’s SEO performance

While 404 errors mainly impact user experience, they can negatively impact your search engine positions too.

First, it’s important to note that a 404 “not found” error doesn’t have a bearing on your website’s SEO performance in and of itself. However, the reasons behind that 404 error could.

For instance, a visitor mistyping a URL is going to result in a 404 error. But it won’t have any negative impact on your SEO. By contrast, broken links that return 404 errors can hinder Google in crawling your site correctly. This might hurt your ranking positions.

If Google encounters many 404 errors during its crawl, it can start to question your site’s overall quality and reliability. This can result in lower rankings or cause search engines to de-prioritize indexing certain pages. And too many unresolved 404 errors might increase your bounce rate, signaling to Google that visitors aren’t finding what they expect.

That’s why it’s vital to keep a log of your 404 errors and fix them as soon as possible. So let’s walk you through how to do that.

How to keep a log of 404 errors

There are two principal methods for maintaining a log of 404 errors – through your web server log files or by using a plugin. Let’s start with the plugin option first.

Use the Redirection WordPress plugin

  1. Install and activate the Redirection plugin.
  2. Once activated, you will be able to view a log of all the 404 errors for your website.
  3. Once you have detected and logged your 404 errors, use the redirection plugin to issue a 301 redirect. This only applies to content that has moved to a new URL.

Use your web server log files

By default, a web server keeps a log of 404 errors in the access log file. Refer to the list of log files every WordPress administrator should know about. Therefore, by referring to the access log file, you can see the 404 errors generated on your website.

This approach is more manual but provides detailed server-side data, which is crucial if you manage a larger site.

Note: Many managed WordPress hosts don’t provide access to server logs. If you’re working with a managed WordPress host, the following process may not be possible.

  1. Access the log files via FTP or your hosting provider’s dashboard.
  2. Search for entries marked as “404” to identify errors.
  3. Note that your server’s logs may include other information. For instance, the time of the request, the URL that triggered the error, and the user agent. These can all help pinpoint the root cause.

If you host your own web server, you can also configure it to log more information about each request. Think of things like the request itself, the referrer, and much more. For example, Apache and NGINX servers allow you to customize log formats to capture details specific to 404 errors, giving you a deeper understanding of why the errors are occurring.

What is the solution to 404 errors?

The solution depends on what the exact situation is. We’ll cover the most common ones below.

Replace

If the 404 error is occurring because a resource or page has been deleted, then one way to solve it is by re-uploading or replacing the page/resource. This way, the URL will no longer return a 404, solving the issue.

Redirect

However, if you have deleted old content that you don’t want to re-upload, another option is to set up a redirect. Redirects tell search engines that a page has moved to a different URL. It will send the user to this new page you’re redirecting to instead of the old URL. This means it is important that the page you are redirecting to is on the same topic so visitors aren’t confused when they land there instead of on the original page. 

If a redirect is the right choice for your situation, you can add it to your website via the web host’s control panel. Or, you can use the Redirection plugin we mentioned earlier. Another option is to manually add them to your website’s .htaccess file (for Apache servers).

To add a single redirect for a page or post using the .htaccess file, add the following directive:

Redirect 301 /old-url https://yourdomain.com/new-url

When to use 301 vs. 302 redirects

As a point of clarity, let’s draw a quick distinction. 301 redirects (as shown above) are used when the content has been permanently moved to a new URL. This is the most common method for handling 404 errors caused by deleted pages or content. It ensures that any SEO value from the old page is transferred to the new one.

302 redirects should be used when the move is temporary and you expect the original content to return.

Ignoring 404 errors

If you intentionally deleted content because it was outdated, irrelevant, or no longer useful, you might not need to worry about a 404 error. If there’s no suitable page to redirect users to, then letting the page 404 and allowing Google to deindex the page naturally is fine.

Over time, Google will drop these pages from their index. And site visitors will stop encountering them in search results. 

If you do choose to “ignore” the 404, it’s still important to check for any internal links pointing to this page on your site. You want to prevent as many visitors as possible from accidentally hitting the 4040 page, for example, by clicking a link pointing to it. You can use a crawler like Seobility’s website audit tool or Sitebulb’s website link crawler to uncover all internal links that return 404s, making it very easy to remove them.

Create a custom 404 page

If the deleted content is no longer relevant, and you don’t have a suitable alternative page to redirect users to, consider creating a custom 404 page that offers suggestions for related content or a search bar. This can help reduce the bounce rate and provide a better user experience.

Imagine if you happened upon a website and landed on a generic 404 Page Not Found page. You’d just hit the back button. But if you saw a custom message, a small explanation, and some suggestions for other content to check out, you’d be much more likely to continue browsing on this site.

Log and track WordPress 404 errors and improve your site

Tracking and logging 404 not found errors is a vital task for any WordPress site owner. These errors uncover broken links that are damaging from an SEO perspective and highlight missing or removed pages that you need to redirect to their new location.

An explosion of 404s could also point to an infection on your website (not common but possible) or indicate that someone is using an automated fuzzer program against it.

Whatever the reason for the 404 errors, keep a log and take the necessary remedial action. Whether that means using a redirection plugin or simply referring to your web server access log files is up to you.
And remember, to get information about the rest of your site, you can use WP Activity Log. It’s a great plugin for knowing the who, what, when, where, and why on your website 24/7.

Posted inWordPress Management
Brenda Barron
Brenda Barron

Brenda is a freelance writer with over a decade of experience with web design, development, and WordPress. When not click-clacking at the keyboard, she’s spending time with her family, playing music, or taking up a new hobby.


Leave a Reply

Your email address will not be published. Required fields are marked *

Stay in the loop

Subscribe to the Melapress newsletter and receive curated WordPress management and security tips and content.

Newsletter icon

It’s free and you can unsubscribe whenever you want. Check our blog for a taste.

Envelope icon
Uploading WP 2FA as a zip file in WordPress
WP 2FA in the WordPress plugin repository
Close

Installing WP 2FA Free

Congratulations on taking the first step towards enhancing your WordPress site's security with WP 2FA Free! You're now on your way to protecting your valuable data and ensuring peace of mind. No coding or technical knowledge is required.

 

Below are two ways to install WP 2FA on your website:

Go to your plugin dashboard on your site, then go to "Add New", and then search for WP 2FA.

Download the WP 2FA plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading CAPTCHA 4WP as a zip file in WordPress
CAPTCHA 4WP in the WordPress plugin repository
Close

Installing CAPTCHA 4WP Free

Well done you. You're one step closer to safeguarding your WordPress website from spam and automated attacks with CAPTCHA 4WP. You'll be able to effortlessly integrate CAPTCHA into your forms and enjoy a website with enhanced security.

 

Below are two ways to install CAPTCHA 4WP on your website:

Go to your plugin dashboard on your site, then go to "Add New", and then search for CAPTCHA 4WP.

Download the CAPTCHA 4WP plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading WP Activity Log as a zip file in WordPress
WP Activity Log in the WordPress plugin repository
Close

Installing WP Activity Log Free on your website

You deserve a pat on the back for choosing to record user actions and changes on your website. That is the first step towards better user accountability, easier troubleshooting of website security, and many other benefits of issues.

 

Below are the two ways to install WP Activity Log on your website:

Go to your plugin dashboard on your site, then go to "Add New" and then search for WP Activity Log.

Download the WP Activity Log plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2

Uploading Melapress Login Security as a zip file in WordPress
Melapress Login Security in the WordPress plugin repository
Close

Installing Melapress Login Security Free

Congratulations on taking control of your WordPress website's security by implementing robust login and password policies with Melapress Login Security. You can change your login page URL, limit failed login attempts, and reset passwords.

 

Below are two ways to install Melapress Login Security on your website:

Go to your plugin dashboard on your site, then go to "Add New" and then search for Melapress Login Security.

Download the Melapress Login Security plugin zip, then select upload in your plugin dashboard under "Add New".

OPTION 1

OPTION 2