Monday, April 13, 2020
How to Fix 404 Errors in WordPress Using 301 Redirects
Looking to fix 404 errors in WordPress? Then read on, as todays 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 arent seeing the web page they were expecting to. Instead, they get something like this: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, theres a plugin for the job perhaps your best solution to fix 404 errors in WordPress its called Redirection, available for free from the official repository: Redirection Author(s): John GodleyCurrent Version: 4.4.2Last Updated: September 29, 2019redirection.4.4.2.zip 86%Ratings 19,796,876Downloads WP 4.8+Requires 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 scenariosThe 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 yourselfThis 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 wont 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.Lets break scenario one down into two further possibilities:a) Existing URL changesIf youve already changed your URLs, youre probably experiencing lots of 404s, right? Thats bad news for everybody, so its time for a quick firefighting job Ã¢â¬â or a long one, depending on how big your website is.In this situation, youre 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 Redir ection button.Now we need to test the redirect. Visit the old URL and, if youve configured the redirect correctly, youll 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 weve discussed, as it involves creating a manual redirect for every single page. If its not too late, there is a better way, thoughb) Future URL changesIf youre 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 automatically create 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.Now go to the Options tab, find the Monitor changes to posts field, and select the group you just created. Hit Update.Go into a pos t, then click to edit the URL extension. When youve 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:Scenario two: incorrect inbound links pointed at known destinationsFor most 404 errors, youre 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 doesnt 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 al l of the 404 errors generated on your website. Go ahead and try it out by attempting to visit a URL on your site that doesnt exist Ã¢â¬â the Redirection plugin will flag the 404 error in real-time.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 youve determined where the link should be pointed, click the Add redirect button.Add the correct URL in the Target URL field. Again, leave the Match and Action options on the defaults, and hit Add Redirection.Easy, huh? Now try to visit the broken link, to confirm that your redirect is active.Scenario three: incorrect inbound links pointed at unknown destinationsIn scenario two, we fixed links pointed at the wrong place when the correct destination could be determined.This wont always be the case, however, or perhaps some links simply arent worth the bother of fixing as theyre so infrequently used.Remember: you ca n 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. Lets be honest: a page like this one is no use to anyone, right?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 arent always the most helpful or creative, as weve just demonstrated. If you want to customize your 404 page, you can do so by editing your themes 404.php file or by installing a plugin.If you go the plugin route Ã¢â¬â and its by far the more user-friendly option of the two Ã¢â¬â I recommend the 404 Page by SeedProd plugin: 404 Page by SeedProd Author(s): SeedProdCurrent Version: 1.0.0Last Updated: July 16, 2018404-page.1.0.1.zip 100%Ratings 11,134Downloads WP 3+Requires This option wont 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!Free guide5 Essential Tips to Speed Up Your WordPress SiteReduce your loading time by even 50-80% just by following simple tips.