WordPress is a powerful CMS. At times, a slight problem can make your site inaccessible. However, to find a solution for every WordPress problem is an easy task. I am trying to cover most of the problems of WordPress for our users.
Like internal server error or error establishing database connection.
WordPress posts returning a 404 error is another common problem that most of the WordPress users are facing these days. In this post, I shall show you how to fix WordPress posts returning 404 error.
In this occasion, a user can access his WordPress admin area and the main page of site. When the user goes to a single post, he gets a 404 not found error. Firstly, you do not need to panic because most of the time your posts are still there and entirely safe. It happens when something went wrong with rewrite rules or your .htaccess file got deleted. You need to fix your permalinks settings.
Go to Settings > Permalinks, and simply click on Save Changes button.
This process will flush rewrite rules and update your permalinks settings. In most of the cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you have to update your .htaccess file manually.
Login to your server by using FTP and modify the .htaccess file which is available in the same location where folders like /wp-content/ and /wp-includes/ are present. You need to make the file writeable temporarily by changing the permissions to 666 that is the easiest way. Now repeat the original solution. Do not forget to change the permissions back to 660. You can also add this code in your .htaccess file manually:
1
2
3
4
5
6
7
8
9
10
|
# 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
Developers and designers often install WordPress on their PC/computer using a local server due to testing purposes. If you want to use permalinks, then you have to enable the rewrite_module in the Apache configuration of your WAMP, MAMP or XXAMP.
I hope that this post will help you to resolve posts returning 404 error in WordPress.
Did this solution work for you?
Do you have any other solution for 404 error or issue?
Kindly share it in the comment section.
Do not forget to share this post.
Arsalan Rauf is an entrepreneur, freelancer, creative writer, and also a fountainhead of Green Hat Expert. Additionally, he is also an eminent researcher of Blogging, SEO, Internet Marketing, Social Media, premium accounts, codes, links, tips and tricks, etc.