WordPress 404 Error Fix
A WordPress 404 means the server has no page at that URL. If every page except the home page 404s, open Settings › Permalinks and click Save Changes so the rewrite rules are rebuilt, then check .htaccess on Apache or try_files on Nginx. If only one URL 404s, restore the page or add a 301 redirect.
For WordPress site owners seeing Page Not Found errors after a migration, a slug change or a server move, who need the right fix quickly.
knowledge
- Read time
- 2 min
- Sections
- 5
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
Is the 404 site-wide or just one URL?
Load the home page, then a known post: if only that post fails, the address is wrong or the page is gone; if every inner page returns 404 while the home page and wp-admin still open, WordPress's rewrite rules are missing. That single test decides which fix you need.
A 404 is not a 500. The server is up and WordPress is running; it simply has nothing to show at that path. A 500 error is a crash with a different fix, covered in WordPress 500 internal server error.
| Pattern | Usual cause | First fix |
|---|---|---|
| Every post and page 404s, home page works | Rewrite rules missing or not applied | Resave permalinks; check .htaccess or Nginx rules |
| One URL 404s | Page deleted, trashed or slug changed | Restore it or add a 301 redirect |
| Images 404 after a move | Files missing from wp-content/uploads or old domain in URLs | Re-copy uploads; run a search-replace on URLs |
| Custom post type pages 404 | Rules not flushed after registering the post type | Resave permalinks |
How do you fix site-wide 404s by resaving permalinks?
Open Settings › Permalinks in wp-admin and click Save Changes without changing anything; WordPress rewrites its rules, and on Apache it also rewrites the .htaccess file.
- In wp-admin, go to Settings › Permalinks.
- Keep the existing structure unless you mean to change every URL, and click Save Changes.
- Reload the failing URL in a private window so a cached tab does not mislead you.
- From the command line, the equivalent is
wp rewrite flush --hardwith WP-CLI.
Choosing a permalink structure is discussed in best WordPress permalink structure.
What should .htaccess or Nginx contain for WordPress permalinks?
On Apache, the site's root .htaccess must contain WordPress's rewrite block and the server must allow overrides with mod_rewrite enabled; on Nginx, the server block must send unknown paths to index.php.
Standard WordPress block for .htaccess in the web root (usually public_html):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If WordPress lives in a subfolder such as /blog/, use RewriteBase /blog/ and RewriteRule . /blog/index.php [L]. If the file is missing or not writable, WordPress shows the rules on the Permalinks screen for you to paste. More on the file is in the .htaccess guide.
Nginx ignores .htaccess. Its server block needs:
location / {
try_files $uri $uri/ /index.php?$args;
}
On managed hosting you cannot edit the Nginx configuration yourself, so ask the host to confirm the rule; on WebJi® WordPress hosting, email support@webji.services. Test with sudo nginx -t before reloading on your own server.
How do you fix a 404 on a single URL?
Restore the page if it was deleted, or add a 301 redirect from the old address to the closest live page if the slug changed or the content moved. Sending every 404 to the home page hides the problem and frustrates visitors, and Google may treat such redirects as soft 404s.
- Deleted by mistake: check Posts › Trash or Pages › Trash, then restore from backup if it is not there.
- Slug edited: add a 301 from the old path; see WordPress 301 redirects.
- Missing image or PDF: re-upload the file or fix its path; do not reinstall WordPress for one missing file.
- Old domain in links: after a migration, run a search-and-replace on URLs; see WordPress search and replace URLs.
What do 404s in Google Search Console mean?
"Not found (404)" in Search Console's Page indexing report means Googlebot requested a URL your site no longer serves; restore or redirect it if it had value, or leave it if it was never meant to exist. Google has said 404s on genuinely removed pages are normal and do not harm the rest of the site.
- Not found (404): a real missing page; check where Google found the link.
- Soft 404: the page returns 200 but looks empty or redirects everyone to the home page; give it real content or a real 404/410.
- Removed on purpose: a 410 Gone status tells crawlers the removal is permanent.
Status codes in general are explained in HTTP status codes.
Should you build a custom 404 page?
Yes: a helpful 404 page that keeps the site header, offers search and links to key pages turns a dead end into a second chance, as long as it still returns a real 404 status. Most themes use a 404.php template you can customise in a child theme; the steps are in custom 404 page in WordPress.
Frequently asked questions
Why do WordPress posts 404 after a migration?
Usually the new server has no WordPress rewrite rules yet: the .htaccess file was not copied, mod_rewrite is off, or the server is Nginx without a try_files rule. Resave permalinks, then check one media URL to confirm uploads were copied too.
Will a new theme fix 404 errors?
Rarely. Themes do not control rewrite rules except in unusual cases. Resave permalinks first; switching theme can introduce new problems without fixing the original one.
Why does wp-admin show a 404?
A security plugin may have moved the login URL, or the admin folder may be blocked by a server rule. Try the custom login address set in the plugin, or rename the plugin's folder over SFTP to disable it temporarily.
Do many 404 errors hurt SEO?
Not directly; removed pages returning 404 are normal. The real loss is when pages that had rankings or backlinks break without a redirect, so their value and visitors go nowhere.
Checked against WordPress developer documentation, 15 November 2026 · Reviewed by the WebJi® team, Jaipur.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.