I originally posted this on Medium around 6 years ago here. It still receives a lot of views in 2023, so thought it was about time I provided an updated version.
When I think about the most frustrating issues I’ve had while working with WordPress, one in particular stands out — 404 Page Not Found errors.
I ran into this quite often when I first started using WordPress and I wasted a lot of time trying to fix it.
It took a while to understand why I was getting these errors — and I see this question asked every couple of weeks — so hopefully this guide will help others struggling with this issue.
We’ve also condensed this guide into a printable cheatsheet. It’s a free download, we only ask you share it if you find it useful.
Backup your website first
Before you start making any changes, make sure you have a recent backup available.
While the suggestions below shouldn’t break your site, it’s always a good idea to backup your installation before you start changing server/configuration settings.
Most web hosts will have some kind of backup tool built in, but if you don’t have one, we recommend using one of the following plugins:
Permalinks
In my experience, permalinks are the issue 90% of the time — especially if you’ve recently added a new plugin or theme.
Whenever you see a 404 error that doesn’t make sense, the first step is to reset your permalinks.
- Go to your Permalinks Settings Page in the dashboard
- Click the button labelled Save Changes
What this does is force WordPress to flush your Rewrite Rules.
Whenever a request for a page is received by your web server, WordPress will look at the URL and try to determine what content needs to be displayed.
It does this internally by comparing the URL against a list of “Rewrite Rules”.
Plugins and themes can add additional rewrite rules, but these are not saved until the rules are flushed.
Images/Static files
If you’re getting 404 errors when accessing images (or other static files), this is more likely to be a server configuration issue.
Make sure the file actually exists
More often than not, the simplest answer is the right one. Using your FTP or CPanel File Browser, navigate to the wp-content folder and find the path matching the URL. For example, if you’re seeing a 404 on an image (ie: https://mysite.com/wp-content/uploads/2023/05/myimage.jpg) – you’ll want to navigate to wp-content/uploads/2023/05 and check if myimage.jpg exists.
Check the permissions of the file
Sometimes your files may not be accessible due to permissions. This is a slightly more technical answer than before, but you’ll want to make sure that the user account running your webserver (www-data is the default user account used by Apache) has permission to read the files.
Debug htaccess
Sometimes changes to .htaccess can override how files are processed and result in 404 errors.
Try renaming the .htaccess file in the root folder of your site via FTP/CPanel (this file may be hidden), and resaving your permalinks using the guide above.
This will generate a new .htaccess file — the .htaccess file determines what requests WP is responsible for.
Caching and Performance Plugins
If you have any caching plugins installed, try disabling these. As mentioned above, some plugins plugins will add custom rules to your .htaccess file which could possibly cause 404 errors.
If you disable caching plugins, backup your .htaccess file and re-save your permalinks (following the above processed) to reset these to their default settings.
Other suggestions
If you get to this point and still haven’t resolved your 404 issues, then it’s probably caused by a much deeper issue within the site/server configuration.
Try disabling all of the plugins on your site and re-save your permalinks settings. If the 404 issue disappears, then it’s most likely caused by one of those plugins.
Re-enable them one-by-one to try to determine which plugin is responsible.
Alternatively, post a comment here or on http://reddit.com/r/wordpress — or find a WordPress developer.
Using Debug This to troubleshoot further
Download the 404 error cheatsheet
If you want a printable version of this blog post, click the download button below. It’s 100% free – but if you find it useful, please share it with others.