
🔧 404 Error in WordPress: how to fix and never lose pages again
You clicked a link to your site and got a blank page with "404 Not Found". But you clearly remember: the post was there, it worked, and you didn't delete it. Annoying situation and, unfortunately, familiar to every WordPress administrator.
Most often the culprit is a simple desync of URL rewrite rules. In practice, 8 out of 10 cases are fixed in a minute with a single button click in the admin panel. And if that doesn't help, we'll go through the remaining causes step by step, from plugins to server settings.
Below, a step-by-step guide: from a quick fix to full diagnostics, including manual .htaccess editing, finding broken links via Google Search Console, and setting up redirects.
💡 Quick overview:
- Save permalinks in the admin panel, this flushes rewrite rules and fixes most 404 errors.
- Check plugins and theme: temporarily disable everything and re-enable one by one to find the conflict.
- Update the htaccess file manually via FTP or the hosting file manager.
- Set up 301 redirects via the Redirection plugin for deleted and moved pages.
- Contact your host if the previous steps didn't help.
Step 1: Save permalink settings
This is the fastest and most effective method. WordPress stores URL routing rules in a special rewrite rules cache, and sometimes this cache gets flushed incorrectly, for example, after a core update or installing a plugin that registers its own post types.
Go to the admin panel: Settings → Permalinks. Don't change anything, just click the "Save Changes" button at the bottom of the page.

WordPress will regenerate the rewrite rules and write them to .htaccess. After that, check the problematic pages, in most cases the 404 error disappears immediately.
If it didn't work, try temporarily switching the link structure to "Plain", save, then switch back and save again. This forces rewrite rules regeneration twice.

Step 2: Check plugins and theme for conflicts
Some plugins interfere with URL routing, register their own rewrite rules, or override existing ones. A conflict between two plugins or a plugin and the theme breaks permalinks, and some pages return 404.
How to find the culprit:
- Make a full site backup. Before any manipulation with active plugins and theme, this is mandatory. Use BackWPup or any other backup plugin you trust.
- Go to Plugins → Installed Plugins and temporarily deactivate all plugins at once (check the box and select "Deactivate" from the dropdown).
- Check if the 404 error is gone. If yes, the problem is in one of the plugins.
- Re-enable plugins one by one and check the problematic URL after each. The one after whose activation the error returns is the source of the conflict.
If deactivating all plugins didn't help, temporarily switch the theme to a default one (Twenty Twenty-Five or Twenty Twenty-Four). A working link under a default theme means the conflict is on your current theme's side.
For safe testing on a live site, use a staging environment (a copy of the site on a subdomain). Many hosts provide it in a couple of clicks via the control panel. If staging is unavailable, run diagnostics during low-traffic hours and restore plugins immediately after checking.
Step 3: Update the.htaccess file manually
Sometimes WordPress cannot write rewrite rules to .htaccess, for example, due to server file permissions or because the file is corrupted. Then even saving permalink settings doesn't help.
Connect to the server via FTP (FileZilla, WinSCP) or open the file manager in your hosting panel. In the site's root folder (where wp-content and wp-includes are located) find the .htaccess file.
Copy its contents and save it in a safe place, if something goes wrong, you can always restore the original.
Now replace the .htaccess contents with the standard WordPress code:
1 ## BEGIN WordPress 2 <IfModule mod_rewrite.c> 3 RewriteEngine On 4 RewriteBase / 5 RewriteRule ^index\.php$ - [L] 6 RewriteCond %{REQUEST_FILENAME} !-f 7 RewriteCond %{REQUEST_FILENAME} !-d 8 RewriteRule . /index.php [L] 9 </IfModule> 10 ## END WordPress
Save the file and check the problematic pages. If the error is gone, the issue was a corrupted .htaccess.
Don't forget to set the file permissions back to 644: a writable .htaccess (666 or 777) is a security hole.
Step 4: Set up redirects for deleted and moved pages
Not all 404 errors are caused by a technical glitch. Some of them are genuinely missing pages: you deleted a post, changed its URL while editing, or restructured category hierarchy.
Such 404 errors are visible in Google Search Console in the "Pages" report, Google logs every inaccessible URL that users or the search bot visited.
To manage redirects, install the free Redirection plugin. It allows you to:
- create a 301 redirect from an old URL to a new one in a couple of clicks;
- monitor all 404 errors on the site in real time (log right in the admin panel);
- set up bulk redirects by pattern (for example, when changing permalink structure).
For every logged 404 in the Redirection journal, you can immediately assign a redirect without leaving the admin panel. This preserves search rankings and prevents visitors from hitting a blank page.
Step 5: Contact your hosting provider
If none of the previous steps helped, the problem is deeper, at the server environment level.
What could be wrong on the hosting side:
- The
mod_rewritemodule is not enabled in Apache. Without it, WordPress cannot form "pretty" URLs, and any permalinks except "Plain" return 404. Support enables it in a minute. - Aggressive server caching (Varnish, Nginx FastCGI cache). Sometimes the cache doesn't flush when saving permalinks, and the server keeps serving old headers. Ask your host to forcibly clear the cache for your domain.
- Incorrect Nginx configuration. If the site runs on an Nginx + Apache stack or pure Nginx, rewrite rules live not in
.htaccessbut in the server configuration file. Rewrite rules regeneration from the WordPress admin panel has no effect on such servers, the hosting provider needs to edit the config.
When contacting support, describe the problem and list the steps you've already taken: this saves time for both you and the engineer.
Other causes of 404 errors in WordPress
Besides rewrite rules failure and plugin conflicts, there are several more scenarios where pages return 404:
- Domain change or site migration. After migration, old URLs don't work if redirects aren't set up. For bulk transfer, use the Duplicator or All-in-One WP Migration plugin, they automatically fix all internal links in the database.
- Deleted media files. If you deleted an image or PDF via the media library, and a link to it remains in the post text, the browser will show 404 when accessing the direct file URL. Use the Media Cleaner plugin to find such "orphaned" links.
- Errors in page hierarchy. When changing a parent page or a category slug, child URLs break. If you restructure, immediately set up redirects from old addresses.
- Malicious activity. A hack or malware infection can replace rewrite rules and add redirects to third-party domains. Regularly update the core, plugins, and theme, and for monitoring use Solid Security (formerly iThemes Security).
⁉️🤔 FAQ
Why doesn't the error go away after saving permalinks?
Most likely, WordPress cannot write changes to
.htaccess, check the file permissions (should be644). If the site runs on Nginx, rewrite rules are managed not via.htaccessbut via the server config, contact hosting support so they manually update rewrite rules for your domain.
How to find all 404 errors on the site in bulk?
The most complete tool is Google Search Console, "Pages" report → "Not found (404)" tab. For real-time monitoring, install the Redirection plugin: it logs every 404 hit right in the admin panel and lets you create a redirect in one click. External crawlers like Screaming Frog also work, but for a one-time audit.
Can I just delete broken links and not set up redirects?
Technically, yes, but you'll lose search rankings and traffic. If external links from other sites pointed to the page, visitors will land on nothing. A 301 redirect passes link equity to the new page and preserves user experience. For mass 404s on an old site, redirecting to the homepage is a last resort, it's better to point each URL to a relevant replacement.
What's the danger of a writable.htaccess?
An
.htaccessfile with666or777permissions can be modified by any process on the server. An attacker who gains access to any vulnerable plugin will append a redirect to a phishing domain, and all your traffic will leak away. Standard permissions644: owner reads and writes, everyone else only reads.
Plugins are deactivated, theme is default,.htaccess is updated, 404 persists. What next?
In the vast majority of cases, the problem is at the server level. Write to hosting support and list the steps already taken. Ask them to check: whether
mod_rewriteis enabled, whether the server is caching old headers, whether Nginx is configured correctly (if used). With this list, the engineer will resolve the issue in one session instead of three back-and-forth exchanges.
404 On WordPress: what to do first
The algorithm is simple and almost always works. Start with the quick fix, saving permalinks (8 out of 10 cases). If it didn't help, go down the chain: plugins → .htaccess → redirects → hosting support. Each next step is slightly more complex than the previous one, but the probability that the problem lies there is also lower.
For prevention, keep three tools handy: a backup plugin like BackWPup, the redirect plugin Redirection, and Google Search Console for monitoring. With them, you don't just fix 404s, you see them before your visitors do.
What cause of 404 errors have you encountered most often? Share your experience in the comments.



