Among the most common error of WordPress, WordPress posts returning a 404 Error also holds a position. A Content Management System (CMS) like WordPress is undoubtedly exposed to a lot of unwanted issues and errors, even from a slight mistake. Sometimes the problems might not be as big as it seems. While, the problems in some cases, might be big. If troubleshooting is not done correctly, these problems may affect your website in the long run.
In case of WordPress posts returning a 404 Error, the WordPress admin area and the blog’s main page is usually accessible, however, you might get a 404 Not found error, while accessing a page or post. Even though you get this error, your posts and data are usually secure.
Causes of the Error:
The 404 Not found error is caused usually in either of the below two scenarios,
- The .htaccess file got deleted.
- The rewrite rules might have some errors.
Fixing the Error:
To fix the 404 Not found error, you need to fix your permalinks settings.
- Go to Settings » Permalinks.
- Click on the Save Changes button.
- The permalinks settings will thus be updated, along with flushing the rewrite rules.
If the above solution fails, the next recommended solution is to update the .htaccess file manually.
- Use FTP to log in to your server.
- Go to the location where folders like /wp-content/ and /wp-includes/ can be found.
- Look for the .htaccess file.
- Modify the file.
- Change the permissions to 666.
- It will temporarily make the file writeable.
- Now, you can follow the original solution.
- Make sure that you change the permissions back to 660, after fixing the issue.
- The below code can also be added in the .htaccess file to serve the same purpose.
# 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
Fix for Local Servers:
To use permalinks, you can allow the rewrite_module in the Apache configuration of your MAMP, WAMP, or XXAMP.