How To Fix WordPress 404 Errors

You get a 404 error when the server can’t find the requested URL. The following post is a guide to help you decide what to do in case you encounter this issue.

WordPress 404 Errors

When should you redirect?

The first thing people think about when getting a 404 error is a redirect. While this can solve the problem, you have to pause and consider whether redirecting is really what you want, since it can have adverse effects on your search engine results.

The first thing you should do is to think whether the content ever existed. If the answer is yes and you’ve changed the domain or the URL structure, you should implement redirect(s) to lead users and search engines to where they wanted to go.

If, on the other hand, that content never existed, you shouldn’t act in any way. Remember, redirecting all 404 errors can be bad for your search engine results.

Troubleshooting the 404 error

WordPress itself can make the whole 404 error troubleshooting process even more difficult than it has to be. That’s because WordPress has its own internal rewrite array that is part of its permalinks feature.

The first thing you should do after getting this error is to find out if it is caused by the server or by WordPress.

If the file you’re having trouble with is static (for example, it’s a .jpg file), open your FTP client and check to see whether it exists.

Consider the following example: the URL is showing a 404 error. Here are the steps you should take:

  1. Open your FTP client and connect to the server
  2. Go to the file’s location
  3. Check to see if the file exists
  4. If the file doesn’t exist, it means this is the source of the 404 error.

On the other hand, if the file does exist, however trying to load the URL in a browser produces the 404 error, you’ll have to look for the cause of the issue somewhere else.

To do that, you’ll have to make a couple of files at the root [/var/www/] and perform some tests.

First of all, create an html file called test.html that contains the message “No problem here”. Upload it to the server and then go to

If you see the message “No problem here” on your screen, it means that the server has no problem processing static files, leaving WordPress as the most likely cause of the error.

Now create a PHP file named test.php which contains this line: <?php echo ‘No problem with PHP’; ?>

Upload the file and go to If there’s a message on your screen which reads “No problem with PHP”, then PHP isn’t the issue either – once again leaving WordPress as the more likely candidate as the cause of the error.

The actual PHP URL string that WordPress uses for this author feed is: If this long PHP URL does not work, you have another problem with your site.

You will now want to start by deactivating plugins one by one to see if you can find the conflicting PHP responsible for the issue.

How to solve the 404 error in WordPress

WordPress creates a rewrite array which manages permalinks (also known as “pretty URLs”). Plugins with faulty code, taxonomy alterations, and custom post types are known to corrupt this permalink array, which causes the 404 error.

A quick way to fix error 404 is by resetting the permalink array. This can be done by visiting the permalinks tab in wp-admin, followed by resaving the permalink structure. Basically just follow these steps:

  1. Go to WordPress Dashboard
  2. Click on Settings
  3. Find Permalinks and there hit Save Changes


Now test the URL you were having trouble with. If it’s no longer there, it means that there was a problem with the permalink structure, and it just got fixed.

Sometimes this quick fix isn’t enough, so you’ll need to find what caused the error. First of all, disable plugins responsible for redirection or creating customized permalinks.

Then, use a debugger to check the rewrite array and see if the rewrite rule responsible for processing your URL isn’t in place. In order to do this, install Debug This and go through the following steps:

  1. Navigate to Homepage, then to Admin Bar.
  2. Go to Debug This.
  3. Find Query and the Rewrites. There, you should see a screen containing rewrite rules on the left and the PHP code being rewritten on the right.

Now that you know where to find the information, what do you do with it? Well, let’s assume there’s a broken author feed. This would look something like To solve this issue, look for the word “author” – you will eventually find this rule: author/([^/]+)/feed/(feed.rdf.rss.rss2.atom)/?$

If you don’t find anything like that, this is the source of the error, as WordPress will not process a request if it doesn’t know what it is doing.

Also deleting an old permalink in WordPress is required when you want to remove the “-2” new urls.

Of course, whenever you’re having trouble with WordPress and nothing seems to work, don’t hesitate to submit a Help Desk ticket.

Add Your Comment