404 errors

Simple Tip to Fix 404 Errors in WordPress

Minimizing the impact of 404 errors is simple. In fact, there are several ways to deal with them. But for first, let’s talk about prevention.

How to Detect Broken Links on Your WordPress Website

Over the course of your site’s life, some links may stop working. In general, any link that doesn’t work as it should is referred to as “broken”.

The broken-link-checker plugin enables you to automate the process of checking the links on your site to identify any broken ones. If it finds one, the plugin will let you know so you can jump in and fix it.

404 errors - plugin

How to Create a Custom 404 Error Page for WordPress

404 error pages in WordPress themes are usually pretty dull and not very helpful. One of the biggest problems with default 404 error pages is that most of them don’t give you enough information. If you’re somewhat tech-minded, you’ll probably take the time to read through your browser’s error description, but most people probably don’t.

There are some plugins that you can use too improve the 404 template in WordPress. Such as :

However, keep in mind that creating  a custom 404 error page isn’t a fix. It’s just a way to lesson the negative impact when this issue pops up. So, let’s talk about some fixes.

Fix 404 Errors in WordPress

A lot of the times, you can fix the WordPress 404 errors by simply flushing your permalinks.

Save Permalink

You can do this by going to Setting >> Permalinks in your WordPress admin area and click on the save changes button without making any changes.

WordPress will automatically update your .htaccess file. You should check your website to confirm that 404 errors are gone.

If it doesn’t, then it’s possible that your .htaccess file isn’t writable, and you may have to manually update it.

Edit your .htaccess File Manually

In most cases, if updating your .htaccess file via the WordPress dashboard doesn’t work, it’s due to a permissions error on your back end. It means you’ll need to get back there and make the changes manually, which is easier than it sounds.

To do this, you’ll need to use an FTP client and access your website using the credentials your web host gave you. Once you’re in, access your WordPress root folder – it’s usually named either public_html, www, or after your site.

This will open the file using your default text editor – you’ll want to delete the contents and replace it with WordPress’ default settings:

Now save your changes and try re-accessing your post. They should be working, although you may have to go back to the Permalinks tab in WordPress and re-configure your URL structure to get it back to the way it was before.

Redirect 404 Errors

A “redirect” is when you take a user visiting one URL, and send them to another one automatically. Your goal is to redirect anyone visiting a non-existing page on your site to another one ( such as your home page, for example)

All you have to do is open your 404.php file in your theme’s folder. If it doesn’t exist, then create a blank php file. Paste the following code in there:

Now when a user hits a 404 page will be redirected to the homepage.

Also you can replace .get_bloginfo(‘url’) with your website domain name to avoid extra request to WordPress to get domain name and make redirection more faster like below.




Finally, test the redirection in your browser window.

We hope this article will help you!