WordpressIntegration.com > Website Design > A Beginner’s Guide on How to Fix the WordPress 404 Error

A Beginner’s Guide on How to Fix the WordPress 404 Error

April 20th, 2021

It’s exciting to see a constant flow of new visitors coming to your WordPress site. It indicates that you’re putting your efforts in the right direction, and your website’s pages are compelling enough to capture the visitors’ attention. However, the experience of new users can soon turn into a nightmare if they encounter the WordPress 404 Error that disappoints them with the page not found message.

No matter how well designed your WordPress site is, the chances are very high that visitors will leave it immediately and probably never revisit it if you don’t redirect them soon to other important pages. Fortunately, there are several ways you can make the situation less distressing and more humorous for users.

In This Article

What Is the WordPress 404 Error?

Simply put, the WordPress 404 error is a standard HTTP response to a user’s query that the server cannot fulfill for various reasons. This means that the browser was communicating with the server, but the server could not send the requested web page. In other words, the WordPress 404 error occurs when a user tries to access a web page that doesn’t exist on the server.

For example, if you have an About page at www.yoursite.com/about and someone tries to access www.yoursite.com/about-us, WordPress would redirect the user to a page named 404.php. By default, if your WordPress theme doesn’t have a 404.php file, the browser displays an error message as plain text against a white background.

Image 1

Since error messages vary from one browser to another, you might see a different message for the WordPress 404 Error in your browser.

  • Not Found.
  • Page Not Found.
  • 404 Not Found.
  • HTTP Error 404.
  • Error 404.
  • The page cannot be found.
  • The requested URL /~ was not found on this server. That’s all we know.
  • The requested URL was not found on this server.
  • We can’t find the page you’re looking for.

If you hate these cheesy messages, you can replace them with a funny or creative 404 page having a catchy message.

What Causes the WordPress 404 Error?

Usually, the WordPress 404 error occurs when a user mistypes an URL, or you delete a web page that is already indexed by search engines or linked on other external websites. Other possible causes of 404 page not found error include:

  • Wrongly typed URL during the page creation
  • Problems with domain name server (DNS) settings
  • Problems with caching
  • WordPress theme/ plugin compatibility issues
  • The page was removed
  • The page was relocated to another URL
  • You move the website from one host to another
  • Lost website content during transfer or due to server malfunctions
  • A change in the permalink of your website
  • The server is not configured correctly to handle the request
  • The content or entered URL is no longer in existence
  • Incorrect redirect to the page that changed the address

Does the WordPress 404 Error Hurt Your Site’s SEO?

According to Google, a 404 page not found error doesn’t have any inherent negative impact on the SEO of your WordPress site. However, bear in mind that it depends on the reason why the error is happening.

For instance, if someone mistypes a URL and encounters a 404 error, you don’t have to worry about it. But, if your site has too many individual 404 errors due to broken URLs, it will constrain Google from crawling your site correctly, which will eventually affect its SEO negatively.

Likewise, if you’re experiencing sitewide 404 errors due to a permalink issue, Google won’t crawl your website content at all. So it’s highly recommended you follow a healthy on-page URL structure and fix your 404 errors as soon as possible.

Does the WordPress 404 Error Affect Your Site Performance?

You may not realize, but if your WordPress site generates many 404 errors, it is more likely to run into performance issues because the server does not cache these responses. This can be a big problem on large sites if you accidentally promote or get a massive amount of viral traffic on a 404 error page.

Given that many 404 pages are very resource-intensive, it can lead to PHP and CPU spikes that can slow or even shut down your WordPress site. To minimize the impact of 404 requests, avoid heavy 404 pages for large websites and cache 404 pages at regular intervals. Try creating a custom lightweight 404 page that doesn’t query the database unnecessarily.

How to Find WordPress 404 Errors?

While you cannot prevent WordPress 404 errors from occurring, you can discover and monitor them through various tools. Here are some pretty simple and easy ways to track them down:

#Google Analytics

If you use Google Analytics on your WordPress site, you can set up a custom report to track 404 errors. Log in to your Analytics account, go to Customization >> Custom Reports, and click +New Custom Report. Then set the parameters as follows.

Image 2

Now, if you save the report and open it, you’ll be able to see the URLs causing 404 errors.

#Google Search Console

Likewise, you can also track WordPress 404 errors in Google Search Console. Log in to your account, go to the Coverage tab, and you’ll be able to see a list of 404 errors that Google’s crawlers have encountered.

Image 3

#WordPress Plugin

If you prefer using a WordPress plugin, then you can try the Redirection or Broken Link Checker plugin to check 404 errors right from your Dashboard.

#Third-Party Audit Tool

Lastly, you can use a third-party audit tool like Ahrefs and Screaming Frog SEO Spider to discover and track 404 errors on your WordPress site.

How to Fix Error 404 Page Not Found on WordPress?

Even if you do your best to avoid WordPress 404 errors, they are bound to occur from time to time. Depending on they’re happening sitewide or to a specific piece of content, here are a couple of different methods to fix this issue:

#Update the Permalinks

If you’re experiencing 404 errors sitewide, then there may be an issue with your permalink structure. You can usually fix it by resetting the permalink array. Navigate to Settings >> Permalinks in your WordPress Dashboard and click Save Changes without making any changes.

Image 4

This will flush rewrite rules and update your linking structure. Now, try accessing the URLs to see if the error is fixed.

In most cases, updating your permalink settings solves the 404 issues. If not, then you have to reset permalinks manually through your .htaccess file that is usually located in the public_html folder.

Image 5

Access the .htaccess file using FTP and and replace all its contents with following code:

# 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

Now, check back with your site. The 404 errors should disappear.

#Set Up 301 Redirects

If you’re experiencing 404 page not found errors on a specific web page, the issue is likely caused by:

  • A change made to the URL slug for that specific piece of content
  • The deletion of the existing post – you moved the particular piece of content knowingly or unknowingly.

In this case, you can set up permanent 301 redirects for missing or renamed content using the aforementioned ‘Redirection’ plugin or something similar. If your host uses the Apache server, you can do the same through your .htaccess file. Place the following line into your .htaccess file:

Redirect 301 /old-page.html http://www.example.com/new-page.html

Make sure to replace the example URLs with the actual URLs. Repeat the process for every page you want to redirect.

Likewise, if there is a change in the file extension, you can use the following snippet of code to redirect all of one type of file extension to another.

RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.htm [R=3f01,L]

The above code will redirect all .php extension files to files with .htm extension.

#Redirect All 404 Pages to the Homepage

Alternatively, you can choose to redirect all your 404s to your homepage using a plugin like All 404 Redirect to Homepage.

If you don’t want to use any plugin, you can add the following code at the beginning of your theme’s 404.php file to redirect all 404 missing links to the homepage.

<?php

header(“HTTP/1.1 301 Moved Permanently”);

header(“Location: “.get_bloginfo(‘url’));

exit();

?>

However, this practice is not recommended as Google still considers broken links as soft 404 errors, negatively affecting your site SEO. According to Google’s John Muller, it confuses users and leads to a bad experience as they land on a page with irrelevant information about their search. Instead, he recommends creating a minimalistic yet compelling 404 page.

What is a 404 Page?

A 404 page is a hidden landing page that appears when users try to access a non-existing page on your site. The primary purpose of a 404 page is to tell visitors the page they requested is no longer available.

The Default 404 Error Page in WordPress

By default, every WordPress has a 404.php file that displays the error message to unfortunate visitors. The standard 404 page is quite generic and contains only the essential information to inform users about the unavailability of the requested page. The best thing, though, is that WordPress allows you to edit the message text to say what you want it to say.

How to Edit 404 Page in WordPress?

To edit your theme’s existing 404 error template file, navigate to Appearance >> Theme Editor in your Dashboard.

Image 6

Click the file named 404.php on the right side of the page, edit the message text in <h1> and <h2> tags, and Save changes. That’s It!

In case your theme doesn’t contain a 404.php file, a better solution is to create a customized 404 page.

Why Does Your WordPress Site Need a Custom 404 Page?

As mentioned earlier, the default WordPress 404 page consists of only the essential text and nothing else. The worst thing is that there are no links to direct users to other areas of your site. Consequently, users have no option other than to leave your website.

A customized 404 page, on the contrary, is designed with a great user experience in mind, so it contains interactive elements to engage and retain your visitors. Here are some of the reasons why you should go with a custom WordPress 404 error page:

  • Encourages visitors to explore your site further
  • Reengage unhappy visitors
  • Build trust with a consistent brand image
  • Help connect with your audience
  • Drive conversions and close sales
  • Add creativity and fun to your website

Needless to say that you’ll need substantial effort and coding knowledge to create a custom WordPress 404 error page. Of course, if you can’t develop it yourself, you can hire certified WordPress developers to build one for you.

8 Elements of a Spectacular WordPress 404 Error Page

The best 404 error pages have a minimal design with no distractions. They incorporate all the essential things to capture the attention of visitors. A good 404 template should contain most of the following elements to ensure a frictionless user experience:

  • An apology in the form of a custom personal message for the error
  • A search box to help users navigate your site
  • Link to your site’s home page or sitemap
  • Your contact details
  • Link to your and latest or most popular posts
  • Provides a way for users to report a broken link
  • Facilitates users to join your email list or use your product
  • Use plain human language that is friendly and inviting. No technical jargon-filled text!

When designing your WordPress 404 error page, make sure it has the same look and feel as the rest of your site. Moreover, it should also not appear on search engine result pages.

Tips to Avoid WordPress 404 Errors in the Future

It’s best to set up a beautiful and helpful custom 404 page to delight your visitors, but it’s far better to take preliminary actions to avoid 404 page not found errors. Following are the things you can do to prevent broken links on your website:

  • Make sure your site is crawled regularly to uncover broken links
  • Migrate pages with proper 301 redirects
  • Keep your permalinks structure clean and concise
  • Remove any page from your site only when it’s necessary.
  • Monitor all incoming links to your site through Google Analytics and Google Search Console. Fix them immediately, if required.

Wrapping Up:-

Whether you like it or not, 404 errors are almost unpreventable on both WordPress and non-WordPress sites. Though this error doesn’t look like a big concern initially, it can ruin your brand, frustrate users, and eventually drop your search engine rankings.

Particularly if you have a big website, it’s pretty common to have ten new broken links every day. So it’s inevitable to monitor these errors continuously, fix them immediately, and create a visually appealing 404 page ASAP. Can’t do it on your own? No problem! Hire WordPress development experts and let them handle everything from fixing WordPress 404 errors to creating a visually appealing 404 page that aligns with your website’s theme, resonates with your brand, and ensures visitors explore your website further.

Certifications &
Partners
Certifications