HOW TO FIX 404 ERRORS IN WORDPRESS USING 301 REDIRECTS

HOW TO FIX 404 ERRORS IN WORDPRESS USING 301 REDIRECTS

Looking to fix 404 errors in WordPress? Then read on, as today’s beginner-friendly tutorial shows you how.

When faced with the 404 error page, many visitors are quick to assume that the website they are visiting is broken. After all, they aren’t seeing the web page they were expecting to. Instead, they get something like this:

fix 404 errors in WordPress: example 404 page

However, this assumption is incorrect. A 404 error does not necessarily mean that something is wrong with your website at all.

A 404 error simply means that the requested URL cannot be found. This could be the result of a broken link, or something as simple as a typo. In other words, 404s are classified as a client-side error – something the visitor has done wrong, whether directly or indirectly.

Even so, 404 errors will inevitably reflect badly on your website – especially to visitors who fail to understand their cause. They can create problems, too, as lots of errors will undoubtedly hurt the visitor experience. And, if the missing webpage is a sales page, well, that pretty much destroys any possibility of scoring a conversion from that visitor.

Hopefully, now you understand that, while 404 errors might not be your fault (although some are), they need to be fixed. And fortunately, there’s a plugin for the job … perhaps your best solution to fix 404 errors in WordPress – it’s called Redirection, available for free from the official repository:

RedirectionRedirection

Author(s): John Godley

Current Version: 3.2

Last Updated: February 18, 2018

redirection.3.2.zip

Today, we are going to look at three common causes of 404 errors, and how to use the Redirection plugin to ‘fix’ them using 301 redirects. While you can create these 301 redirects without using a plugin by editing the .htaccess file manually, the Redirection plugin is the quickest and easiest solution to fix 404 errors in WordPress.

How to fix 404 errors in WordPress: the possible scenarios

The three scenarios we are going to be looking at are:

  • Changing URLs yourself.
  • Problems with inbound links pointed at known destinations.
  • Problems with inbound links pointed at unknown destinations.

Scenario one: changing URLs yourself

This is the one scenario we have full control over.

If, for whatever reason, we decide to change our URLs – most likely a result of changing permalinks – then all of our existing URLs become redundant, effective immediately.

For example, when we switch from example.com/2016/old-link to example.com/new-link, the original URL no longer exists. Requesting that URL will return an error.

Of course, we still want our existing posts and pages to work. Therefore, we need to configure 301 redirects to resolve the problem.

A 301 redirect is the best redirect in most situations – it tells the search engines that the web page has permanently moved. As a result, the search engines won’t penalize you for the changes, and your SEO ranking is preserved – read more about the redirect types here. Fortunately, the Redirection plugin specializes in 301 redirects.

Let’s break scenario one down into two further possibilities:

a) Existing URL changes

If you’ve already changed your URLs, you’re probably experiencing lots of 404s, right? That’s bad news for everybody, so it’s time for a quick firefighting job – or a long one, depending on how big your website is.

In this situation, you’re going to have to create the 301 redirects manually.

Start by making a note of all your old URLs and the corresponding new URLs. Now navigate to Tools / Redirection.

Under the Add new redirection heading, add one of your redundant URLs in the Source URL field. Although there are numerous options for the Match field, ‘URL only’ works best here, so leave it as is.

Similarly, because we know the target location for our web page, we can leave the Action field set to ‘Redirect to URL.’ Leave the Regular expression field blank.

Finally, input the correct URL in the Target URL field. Finish by clicking the Add Redirection button.

Redirection 301 Redirect

Now we need to test the redirect. Visit the old URL and, if you’ve configured the redirect correctly, you’ll immediately be relocated to the correct URL.

Great, your first attempt to fix 404 errors in WordPress is a success!

This is quite a laborious process we’ve discussed, as it involves creating a manual redirect for every single page. If it’s not too late, there is a better way, though…

b) Future URL changes

If you’re considering changing your URLs, do yourself a favor and install the Redirection plugin now. This will save you a lot of time and frustration down the line.

This is because Redirection will track all changes to existing URLs and automaticallycreate a 301 redirect when it detects any changes.

Before you start, click through to Tools / Redirection, then click on the Groups tab. Name your group, set it to WordPress Posts, then click Add.

Redirection Group

Now go to the Options tab, find the Monitor changes to posts field, and select the group you just created. Hit Update.

Redirection Options

Go into a post, then click to edit the URL extension. When you’ve made your changes, hit OK and then Update.

Now, when you navigate back to Tools / Redirection, you will see the plugin has already done the hard work. It has already created a 301 redirect, pointing the old URL at the new one:

Redirection Auto 301 Redirect

Scenario two: incorrect inbound links pointed at known destinations

For most 404 errors, you’re completely blameless, though. For example, we all want lots of inbound links from high authority websites, right? But what if those websites make a mistake and point their link at the wrong place?

In this situation, anyone who clicks that link will arrive at a URL that doesn’t exist, producing a 404 error. As you have no control over the external website, how do you go about fixing this problem?

One option is to reach out to the webmaster regarding any known broken links. Failing that, you can turn to the trusty Redirection plugin again.

Navigate to Tools / Redirection. Next, click on the 404s tab. This screen will list all of the 404 errors generated on your website. Go ahead and try it out by attempting to visit a URL on your site that doesn’t exist – the Redirection plugin will flag the 404 error in real-time.

Redirection 404 detection

Now, not all 404s are worth fixing, but if you see one URL appearing multiple times, you might want to point it at the right place. If the right place is obvious, that is.

When you’ve determined where the link should be pointed, click the Add redirectbutton.

Redirection Add Redirect

Add the correct URL in the Target URL field. Again, leave the Match and Actionoptions on the defaults, and hit Add Redirection.

Redirection Correcting Broken link

Easy, huh? Now try to visit the broken link, to confirm that your redirect is active.

Scenario three: incorrect inbound links pointed at unknown destinations

In scenario two, we fixed links pointed at the wrong place when the correct destination could be determined.

This won’t always be the case, however, or perhaps some links simply aren’t worth the bother of fixing as they’re so infrequently used.

Remember: you can never prevent or fix 404 errors in WordPress entirely. They are just a part of running a website. The question is: how do you keep the impact of a 404 error to a minimum?

This is the default error message produced by the Twenty Sixteen theme. Let’s be honest: a page like this one is no use to anyone, right?

Example Error Page

Even if the correct destination cannot be determined, you can still serve the customer something more useful than this. For example, you might refer visitors to your most useful resources to get them up and running. Or you might simply redirect them to another existing page, such as the homepage.

Every WordPress theme ships with a default 404 error page, but they aren’t always the most helpful or creative, as we’ve just demonstrated. If you want to customize your 404 page, you can do so by editing your theme’s 404.php file or by installing a plugin.

If you go the plugin route – and it’s by far the more user-friendly option of the two – I recommend the 404 Page by SeedProd plugin:

404 Page by SeedProd404 Page by SeedProd

Author(s): SeedProd

Current Version: 1.0.0

Last Updated: December 13, 2017

404-page.1.0.1.zip

This option won’t fix 404 errors in WordPress per se. However, by presenting visitors with a useful alternative to the content they were looking for, they are far more likely to remain on your website. And maybe you can still score that conversion after all.

How do you fix 404 errors in WordPress? Share your thoughts, and feel free to ask any questions in the comments below!