How to Fix 404 Errors on WordPress Pages and Posts

A 404 error means the server couldn’t find anything at the address requested. One 404 on a mistyped URL is normal. A page you know exists returning 404, or every page except the homepage suddenly returning 404, is a fault you can fix, usually in a few minutes.

This guide helps you work out which kind of 404 you have and fixes each one, starting with the quickest checks. Screenshots come from a WordPress 7.1.3 test site.

Here is what visitors see on a missing page with Twenty Twenty-Five, the default theme:

Twenty Twenty-Five 404 page with a black and white photo of a windswept tree, the heading Page not found, a short explanation and a search box
The default 404 page in Twenty Twenty-Five on a test site (the photo is bundled with the theme).
Troubleshooting diagram: if every page except the homepage is 404, re-save permalinks and check .htaccess or server rules; if one page, check status, slug, parent and conflicts, then add a 301 redirect; if a section after a theme change, restore the post type
Start by asking how many pages are affected.

First: one page, or all of them?

  • One page or post returns 404: the content was moved, renamed, unpublished or deleted, or the link is wrong. Go to Single page 404s below.
  • Every page except the homepage returns 404: WordPress’s permalink rules aren’t working. Go to Site-wide 404s.
  • A whole section returns 404 (for example all portfolio items after a theme change): the post type that served them is no longer registered. Go to 404s after changing themes or plugins.

Site-wide 404s: refresh the permalinks

This is the most common case after moving a site, changing hosting or restoring a backup, and it has the simplest fix:

  1. Go to Settings › Permalinks.
  2. Don’t change anything. Just click Save Changes at the bottom.
WordPress Permalink Settings screen with the Post name structure selected among Plain, Day and name, Month and name, Numeric and Custom Structure
Settings › Permalinks. Clicking Save Changes without changing anything rebuilds the rewrite rules. URLs show the test environment’s address.

Saving rebuilds WordPress’s rewrite rules, the internal map that turns a pretty URL into the right post. On Apache servers it also tries to update the .htaccess file.

If the 404s continue:

Check .htaccess (Apache and LiteSpeed servers)

Open .htaccess in the site’s root folder. For a standard single-site install it should contain this block:

# 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 the block is missing, back up the file, add it, and save. If WordPress is installed in a subfolder, RewriteBase and the last rule include the folder name. If the file isn’t writable, the Permalinks screen will tell you and show the rules to copy.

Check the server configuration (Nginx)

Nginx doesn’t read .htaccess. The server configuration needs a rule that passes unknown URLs to WordPress’s index.php. On managed hosting, ask your host to check it; if you manage the server, the WordPress documentation on Nginx lists the standard configuration.

Single page 404s

Work through these in order:

  1. Is it published? Open Pages or Posts and find it. Drafts, scheduled, private and trashed items return 404 to visitors. Check the Trash view too.
  2. Is the address right? Open the page in the editor and compare its URL (the slug) with the link that fails. A slug changed from services to our-services breaks every old link.
  3. Is it a child page? Child pages include the parent’s slug in their URL (/about/team/). Moving a page to a different parent changes its address.
  4. Is another item using the same address? A page and a category, or a page and a custom post type archive, can compete for the same URL. Rename one.

Old links after changing a slug

WordPress automatically redirects old slugs of posts to their new address, but not of pages, which are hierarchical. Whenever you rename a page or delete content that had links or search traffic, add a 301 redirect from the old address to the best new one.

Redirects can be added by your host, in .htaccess, or with a plugin. Redirection is one widely used free plugin (version 5.10.1, 2,000,000+ active installations, checked 20 October 2026); it can also log 404s so you see which missing addresses visitors actually request. Many SEO plugins include a redirect manager too; use one tool for redirects, not several.

404s after changing themes or plugins

If portfolio items, team members, services or events disappear after a theme change, the old theme probably registered them as a custom post type. The content is still in the database, but no active code tells WordPress how to show it. Options:

  • reactivate the old theme temporarily to export or move the content;
  • install the plugin the new theme recommends for that content type;
  • register the post type with a small plugin, using the same name the old theme used.

Then refresh the permalinks as above. Our theme switching guide lists what to check before you switch, so this doesn’t catch you out.

Security or redirect plugins can also cause unexpected 404s, for example by hiding the login page or blocking certain URLs. If the problem started after installing or updating a plugin, test by deactivating it on a staging copy; our staging guide shows how to set one up.

Make the 404 page useful

Visitors will still hit missing pages from old links and typos. A good 404 page helps them continue:

  • a short, plain explanation;
  • a search box (Twenty Twenty-Five includes one by default, as in the screenshot above);
  • links to the main sections or the most visited pages;
  • a contact link.

In a block theme, edit the Page: 404 template under Appearance › Editor › Templates. In a classic theme, the page comes from the theme’s 404.php file; customize it in a child theme or check whether the theme offers a 404 setting.

Find 404s before visitors report them

  • Google Search Console reports URLs Google tried to crawl that returned “Not found (404)”. Check the pages report after site changes.
  • A redirect plugin’s 404 log shows real visitor requests.
  • Broken internal links: after reorganizing pages, check your menus, buttons and links inside posts. Our site structure guide helps you plan URLs that stay stable.

Not every 404 needs a redirect. Random addresses requested by bots, or pages that never existed, can return 404 safely. Redirect only addresses that had real content, links or traffic, and send them to the closest equivalent page, not just the homepage.

Need help?
Need a custom theme for your project?