The “404 Not Found” error is a common issue that WordPress users encounter. This error indicates that the server could not find the requested page. Understanding the problem, its symptoms, causes, and resolutions can help you fix it efficiently.
Problem
The “404 Not Found” error in WordPress occurs when the server is unable to locate the page or post you are trying to access. We know this can be frustrating for both site administrators and visitors. The good news is it’s normally very easy to resolve.
Symptoms
- Trying to access a page results in a “404 Not Found” error message.
- Specific pages or posts are not reachable while others work fine.
- The homepage or some main sections of the website work, but internal links do not.
Causes
- Incorrect Permalink Settings: Permalinks might not be configured correctly.
- Corrupted .htaccess File: The .htaccess file may be missing or corrupted.
- Plugin Conflicts: A plugin might be interfering with the page URL structure.
- Theme Issues: The current theme might have coding errors or conflicts.
- Slug Conflicts: Duplicate or incorrect slugs (URL paths) for pages or posts.
Resolution
1. Refresh Permalinks
- Log in to your WordPress dashboard.
- Navigate to Settings > Permalinks.
- Click the Save Changes button without altering any settings to refresh the permalink structure.
2. Update .htaccess File
Using FTP
- Connect to your website via FTP or through your hosting control panel’s file manager.
- Locate the .htaccess file in the root directory of your WordPress installation. If you cannot find it, the file might be hidden, not uploaded, or deleted.
- If the .htaccess file exists, back up the existing file by downloading it to your local computer.
- Open the .htaccess file for editing. If it does not exist, create a new file named .htaccess.
- Replace its contents with the following default WordPress code:
“`plaintext
</ol>
<h1>BEGIN WordPress</h1>
<p>RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<h1>END WordPress</h1>
<pre><code>“`
- Save and upload the updated file back to your server.
Using cPanel File Manager
- Log in to your hosting account’s cPanel.
- Navigate to the File Manager under the Files section.
- In the File Manager, go to the root directory of your WordPress installation (usually public_html).
- Locate the .htaccess file. If you cannot see it, ensure that hidden files are visible by clicking Settings in the top-right corner and checking Show Hidden Files (dotfiles).
- Make a backup of the current .htaccess file by downloading it to your local computer.
- Right-click on the .htaccess file and select Edit.
- Replace the contents with the following default WordPress code:
“`plaintext
</ol>
<h1>BEGIN WordPress</h1>
<p>RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<h1>END WordPress</h1>
<pre><code>“`
- Save the changes and close the editor.
3. Deactivate Plugins
- Go to Plugins > Installed Plugins in your WordPress dashboard.
- Deactivate all plugins.
- Check if the error persists. If it’s resolved, reactivate each plugin one by one, checking your site after each activation to identify the problematic plugin.
4. Switch to Default Theme
- Navigate to Appearance > Themes in your WordPress dashboard.
- Temporarily switch to a default theme like Twenty Twenty-One.
- Check if the pages load correctly. If so, the issue is likely with your theme. Update it or contact the theme developer for support.
5. Check for Page or Post Slug Issues
- Edit the page or post returning a 404 error.
- Verify that the slug is correctly set in the URL field.
- Save the changes. Ensure that no two pages or posts have the same slug.
6. Restore a Backup
If the 404 errors started after recent changes and none of the above solutions work:
- Use your backup solution (provided by your hosting or a plugin) to restore your site to a point before the errors began.