WordPress Website Templates

Find Professional WordPress themes Easy and Simple to Setup

inner banner

How to Fix WordPress Posts Returning 404 Error

Returning 404 Error

If you are working with WordPress then you would be used to WordPress posts returning error 404; it’s more common than you would think and there’s no reason for you to hit the panic button just yet.

The fact remains that WordPress is not as perfect as we would all like it to be but for the moment, it happens to be the best platform out there, to base your website on.

A simple tweak can cause your whole website to shut down but the good news is that most of the errors on WordPress are easily solvable, and all that’s required on your part is to follow the simple directions as listed below.

Usually, this error takes place when the server is unable to locate the post URL and returns the 404 error. However, with the steps listed below, you can easily see that this issue, like many others is solvable.

More often than not, the user is able to access the main admin area but gets a 404 error when he tries to read a post. The thing to remember is not to panic and to follow the steps as shown below, to resolve the issue at the earliest.

  • Htaccess file: Most of the errors that WordPress experiences can be laid at the door of the htaccess file for the simple reason that the file in question contains configurable rules for the server.

    So if your server cannot locate the post URL, this is the first place that you would check. Just head over to your admin dashboard (assuming that you can still access the same), once you are logged into your website, head over to settings> permalinks and then click on save changes.

    Usually, this should help resolve the 404 issue, update permalinks and flush any rewrite rules. If it does not work, then you have to update the ht access file manually.

You can login to your FTP account with the credentials provided by your host; once you are logged in, just head over to your root directory, you should be able to see the file listed with wp-content/, wp-includes/ and the rest.

Now, download the htaccess file and save it on your system. Basically, you are attempting to change the permissions and make the file rewritable by changing permissions to 666, you can always change it back to 660. Just add the code as shown below to your htaccess file and you should be set.

# 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

  • Using redirect: Most users often have the idea that when a 404 error occurs, then they’ll simply do a redirect and that’s it.

    A redirect at most is a temporary fix and the underlying problem remains the same. And unless the issue is tackled at the earliest, you are bound to end up with more problems than before and even a downed website as a result.

  • Enabling custom permalinks: It is common practice among programmers to migrate their website to a new server from the local server on which they were hosted but the issue is that customized permalinks do not migrate just like that.

    In other words, with a brand new server, 404 errors are bound to happen more often. The only way that you can get around this is by enabling rewrite in the apache module.

    For this, you need to have MAMP, WAMP, or XXAMP installed. Once you are logged in, you can click on the WAMP icon in the task bar, after which, you should navigate to apache modules. 

    The drop down list should just about contain a lot but it should also contain “rewrite_module”, just click on the same.  It should bring up a lot of modules and you can just click “on and off”. 

    After doing this, your custom permalink should work just fine and the 404 error when you click on the permalink should be resolved.

    If it does not work, then you need to head over to the apache folder, find and locate the file titled “conf”, once you have located the file, locate the httpd.conf.file, download the same to your system.

    Search for a particular piece of code and make changes to it as shown below; once you have done it, you can upload the file to the same directory and the error should be fixed now.

#LoadModule rewrite_module modules/mod_rewrite.so

Simply get rid of the pound sign in front of it. So it looks like this:

LoadModule rewrite_module modules/mod_rewrite.so

As mentioned earlier, the 404 is quite simple enough to fix but it is a good idea to always go in for a complete backup before you tinker with any of the core files.

A even better idea would be to go for a professional website design company that offers you a complete services, so you can be assured that even if you were to change any of the core files, the same would be stored in its original form, elsewhere.

We would encourage you to contact your host if any of the above measures do not work, as one of the underling issues could be something else altogether or some of your core files are corrupted.

In which case, you need to head over to WordPress.org, download and install the same version that you are using, and download the same to your system.

Now, upload all the files with the exception of wp-content and see if that helps to resolve this issue once and for all. Generally speaking it does but remember to use it as a last stop gap measure before calling in the professionals.

What you need to remember is this, the longer your website stays down, the longer your customers would go without the requisite data or information.

This is why it is vital that all your permalinks are working just as they are supposed to and that your 404 error is indeed a thing of the past.

By following the steps listed above, you should be able to resolve the 404 error on your own and without calling in the professionals.