A common issue WordPress users face is that their homepage works perfectly fine, but clicking on any post or page results in a “404 Not Found” error.
This is almost exclusively an issue with your site’s permalink settings or the .htaccess file.
Why Does This Happen?
WordPress uses rewrite rules stored in the .htaccess file to generate pretty permalinks (like yoursite.com/my-awesome-post). If the .htaccess file gets deleted, corrupted, or if WordPress doesn’t have the permissions to update it, the server won’t know how to route the URL, resulting in a 404 error.
How to Fix It
1. Flush Your Permalinks (The Easy Fix)
In 90% of cases, you can fix this issue entirely from your WordPress dashboard without touching any code.
The Fix:
- Log into your WordPress admin dashboard.
- Navigate to Settings > Permalinks.
- Do not change any settings. Simply scroll to the bottom and click the Save Changes button.
This forces WordPress to flush its rewrite rules and generate a fresh, correct .htaccess file.
2. Manually Update .htaccess (The Manual Fix)
If flushing permalinks didn’t work, it usually means WordPress doesn’t have write access to the .htaccess file due to server permissions. You’ll need to update it manually.
The Fix:
- Log into your site via FTP or your host’s File Manager.
- Locate the
.htaccessfile in the root directory. If it doesn’t exist, create an empty file named.htaccess. - Open the file and replace its contents with the default WordPress rewrite rules:
# 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
- Save the file.
- Check your website—your posts should now load correctly!
3. Check for Plugin Conflicts
Very rarely, an SEO or caching plugin might interfere with rewrite rules. If the manual fix above gets overwritten shortly after you apply it, try disabling your SEO/Caching plugins, saving your permalinks again, and checking if the issue resolves.
