WordPress Pages Returning 404 (Permalink Issue)
Warning Frequency: CommonError message:
404 Not Found — page exists but returns 404One of the most common WordPress issues: your pages and posts exist in the database, but visiting them returns a 404 Not Found error. Only the homepage works. This is almost always a permalink/rewrite rule issue.
WordPress uses URL rewriting to create pretty permalinks (e.g., /my-post/ instead of ?p=123). If the rewrite rules are missing or corrupted, the web server can’t route requests to WordPress, and you get 404s.
Common Causes
- Corrupted or missing .htaccess file (Apache)
- nginx missing try_files directive for WordPress
- Rewrite rules need flushing after migration or plugin change
- mod_rewrite not enabled on Apache
- Custom post type rewrite rules not flushed after plugin activation
How to Fix It
- Flush permalinks: Go to Settings > Permalinks, don't change anything, just click Save Changes
- Check .htaccess: Make sure it contains the standard WordPress rewrite rules (Settings > Permalinks will regenerate them)
- For nginx: Add
try_files $uri $uri/ /index.php?$args;in your server block - For Apache: Ensure mod_rewrite is enabled:
sudo a2enmod rewrite && sudo systemctl restart apache2 - For custom post types: Run
wp rewrite flushvia WP-CLI after activating CPT plugins
Frequently Asked Questions
Why do my WordPress pages show 404 when they exist?
This is a permalink/rewrite rule issue. Go to Settings > Permalinks and click Save Changes to regenerate the rewrite rules. This fixes it 90% of the time.
My .htaccess keeps getting overwritten. What should I do?
A plugin or your server config might be overwriting it. Make sure .htaccess is writable (644) and check if a security or caching plugin is modifying it.
Get WordPress Performance Tips
Plugin reviews, speed optimization guides, and error debugging — straight to your inbox.
No spam. Unsubscribe anytime. We respect your privacy.