Listen to this article
8 minute listen
Narrated by an AI voice · 13 chapters
AI Overview
When your home page loads but every post and page returns a 404 error, WordPress permalinks are broken. Re-save the permalink settings first, then check .htaccess on Apache or the try_files rule on Nginx, and look for slug conflicts and plugins that changed the rewrite rules.
Key takeaways
- If the home page works but posts return 404, the permalinks or server rewrite rules are broken, not the content.
- Re-saving Settings > Permalinks without changes rebuilds the rewrite rules and fixes most cases.
- Apache needs the WordPress block in .htaccess; Nginx needs try_files $uri $uri/ /index.php?$args.
- Migrations, slug conflicts and plugins that add custom post types are the usual triggers.
- Monitor individual posts, because broken permalinks leave the home page and uptime checks looking fine.
Free WordPress plugin
Know which plugin update broke your site.
The free MyKavo plugin watches your site through every plugin, theme and core update, and tells you which one caused a change, before your visitors find it.
- Records every plugin, theme and WordPress update
- Checks your key pages right after each update and names the one that broke something
- One-click rollback when an update goes wrong, free
- Changes, alerts and before-and-after proof inside wp-admin
Free on WordPress.org · WordPress 6.2+ · PHP 7.4+ · The check after each update comes with every paid plan
Summarize with AI
Opens the assistant in a new tab with a link to this post.
On this page
Your home page loads fine, but every post, page or category link shows "404 Not Found". Nothing is deleted: the content is still in wp-admin. WordPress simply cannot match the address to the post anymore.
This is a permalink problem, and it is one of the most common issues after a migration, a server change or a plugin update. Here is how to fix it, step by step.
What permalinks are and why they break#
Permalinks are the readable addresses of your posts, such as example.com/blog/my-post instead of example.com/?p=123. Behind the scenes, two things make them work:
- The web server sends every request that is not a real file to WordPress's index.php. On Apache this is done by rules in the .htaccess file. On Nginx it is done by a try_files line in the server configuration.
- WordPress's rewrite rules then match the address to a post, page, category or custom post type.
If either step fails, the server or WordPress cannot find the post and returns a 404 error.
1. Re-save your permalink settings#
This fixes most cases and takes ten seconds:
- Go to Settings > Permalinks in wp-admin.
- Do not change anything. Click Save Changes.
Saving flushes and rebuilds WordPress's rewrite rules and, on Apache, rewrites .htaccess if WordPress is allowed to. Test a post again. If it works, you are done.
2. Check the .htaccess file (Apache and LiteSpeed)#
If saving did not help, open .htaccess in the site's root folder with your host's file manager or SFTP. It is a hidden file, so enable "show hidden files" if you cannot see it. A standard WordPress site needs this block:
BEGIN WordPress
RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
END WordPress
If WordPress is installed in a subfolder, RewriteBase and the last rule use that folder, for example /blog/ and /blog/index.php.
Common problems:
- The file is missing, often after a migration that skipped hidden files. Create it with the block above.
- WordPress cannot write to it. The permalink screen then shows a message asking you to update .htaccess yourself. Copy the rules from there.
- Another plugin or a security rule broke it. Rename the file to .htaccess-old, re-save permalinks to create a clean one, then add back only the rules you need.
If editing .htaccess causes a 500 error, the file has a syntax mistake. Our 500 internal server error guide explains how to find it.
Try it on your site · free
Check your own page's meta tags
Title, description, canonical and robots - including an accidental noindex - in a few seconds.
3. Check mod_rewrite and AllowOverride#
On your own server or VPS running Apache, .htaccess rules only work if the rewrite module is enabled and the site's configuration allows overrides. Make sure mod_rewrite is enabled and that the site's directory has AllowOverride All. On managed hosting this is already set; ask support if you are unsure.
4. Check the Nginx configuration#
Nginx ignores .htaccess completely. If your host runs Nginx, the server block needs a location rule that passes requests to WordPress:
location / { try_files $uri $uri/ /index.php?$args; }
If you moved from an Apache host to an Nginx one, this rule is often the missing piece. On managed hosting, ask support to confirm it is in place.
5. Look for slug conflicts#
If only some addresses return 404, two things may be competing for the same slug:
- A page and a category or custom post type with the same name.
- A post in the trash still holding the slug.
- A permalink structure that starts with %postname% and clashes with a page.
Rename one of them, empty the trash, and re-save permalinks.
6. Check plugins and custom post types#
Plugins that add custom post types (products, events, portfolios) register their own rewrite rules. After installing, updating or switching such a plugin, its pages may return 404 until the rules are flushed. Re-save permalinks after any such change. If 404s started right after an update, see our guide to WordPress plugin conflicts.
7. After a migration: check the site address#
When a site moves to a new domain or from http to https, check Settings > General. A WordPress Address or Site Address that still points at the old domain sends links to the wrong place. Our website migration guide has a full checklist.
Why broken permalinks hurt SEO#
A post that returns 404 drops out of Google over time, and the links pointing to it stop passing value. When every post breaks at once, a site can lose most of its search traffic within days. Read more about 404 errors and SEO and how to check why a page is not indexed.
How to prevent it#
- Re-save permalinks after migrations, server changes and plugin changes that add new content types.
- Copy hidden files such as .htaccess when you move a site.
- Do not change the permalink structure on an established site without 301 redirects from the old addresses.
- Monitor your key posts and pages, not just the home page, because broken permalinks leave the home page working.
Catch broken permalinks the same day#
Broken permalinks are sneaky: the home page loads, so a simple uptime check reports that everything is fine while every post returns 404. MyKavo checks the pages you choose, including posts and product pages, and alerts you when one starts returning a 404 or another error. The free MyKavo WordPress plugin also records plugin, theme and core changes, so you can see what changed right before the 404s started.
Frequently asked questions#
Frequently asked questions
Why do my WordPress posts show 404 but the home page works?
The permalinks are broken. The server is not passing post addresses to WordPress, or WordPress's rewrite rules are outdated. Re-save Settings > Permalinks, then check .htaccess on Apache or the try_files rule on Nginx.
How do I fix WordPress permalinks?
Go to Settings > Permalinks and click Save Changes without changing anything. This rebuilds the rewrite rules. If that does not work, restore the default WordPress block in .htaccess or add try_files $uri $uri/ /index.php?$args; to the Nginx configuration.
Where is the .htaccess file in WordPress?
In the root folder of the site, next to wp-config.php. It is a hidden file, so turn on hidden files in your file manager or SFTP client to see it.
Why did my permalinks break after a migration?
Migrations often skip hidden files such as .htaccess, move the site to a server with a different configuration such as Nginx, or leave the old domain in Settings > General.
Does changing the permalink structure hurt SEO?
It can. Every old address becomes a 404 unless you add 301 redirects from the old addresses to the new ones. Change the structure only when needed, and redirect every old URL.
How can I find out when my posts start returning 404?
Use a monitoring tool that checks individual posts and pages, not just the home page. MyKavo checks the pages you choose and alerts you when one returns a 404 or another error.
Write for MyKavo
Know website monitoring, WordPress or SEO from real work? Pitch us a guide. You keep a byline with one link to your site. Read the guidelines
Get alerted when your site breaks. Free, no card.
Start free