Category: WordPress Troubleshooting
How to Fix WordPress 404 Not Found Errors
A WordPress 404 Not Found error means the requested page, post, file, or URL could not be found by the server. Sometimes this happens because the page was deleted or moved. Other times, the content still exists inside WordPress, but broken permalinks, missing rewrite rules, plugin conflicts, wrong slugs, or server configuration issues stop WordPress from loading it correctly.
The good news is that most WordPress 404 errors are easy to fix once you know whether the issue affects one URL, many URLs, or the entire site except the homepage. This guide walks you through safe fixes for broken WordPress permalinks, corrupted .htaccess files, missing redirects, deleted pages, custom post type 404s, media file 404s, and SEO-related broken links.
TL;DR: Fastest Safe Fix
To fix WordPress 404 errors, first check whether the error affects one page or the whole site. If all posts/pages show 404 but the homepage works, go to Settings → Permalinks and click Save Changes without editing anything. If that does not work, reset your .htaccess file on Apache/LiteSpeed or check Nginx rewrite rules. For individual 404 pages, check the page slug, restore the deleted page, update internal links, or create a 301 redirect to the most relevant working URL.
What Is a WordPress 404 Not Found Error?
A 404 Not Found error appears when the browser requests a URL, but the server cannot find a matching resource. In WordPress, this can happen even when your content still exists in the dashboard, because WordPress depends on permalink rules to map clean URLs to the correct posts, pages, categories, products, archives, and custom post types.
For example, your homepage may work perfectly, but all blog posts show 404. That usually points to a permalink or rewrite-rule problem. If only one page shows 404, the issue is more likely a changed slug, deleted page, missing redirect, broken internal link, or incorrect URL.
Common ways the error appears:
- Your homepage works, but all posts show 404.
- Only one page or post shows 404.
- WooCommerce product pages show 404.
- Category, tag, author, or archive pages show 404.
- Custom post types show 404 after adding new code or a plugin.
- Media files, PDFs, images, or downloads return 404.
- Old URLs from Google, social media, or backlinks lead to 404 pages.
External reference: MDN explains the HTTP 404 status here: 404 Not Found - HTTP.
What Usually Causes WordPress 404 Errors?
WordPress 404 errors can be caused by content changes, permalink problems, server rewrite issues, plugin conflicts, or migration mistakes. The fix depends on the scope of the issue.
Most common causes include:
- Broken permalinks: WordPress rewrite rules are outdated or not regenerated properly.
- Corrupted .htaccess file: Apache or LiteSpeed rewrite rules are missing, duplicated, or malformed.
- Deleted or moved page: The content was removed or the URL changed without a redirect.
- Changed slug: A post, page, product, category, or tag slug was edited.
- Plugin conflict: SEO, redirect, multilingual, membership, security, cache, or custom post type plugins may affect routing.
- Theme or custom code issue: Custom post types or rewrite rules may not be registered correctly.
- Migration problem: The site was moved, but permalinks, URLs, or server rules were not updated.
- Nginx rewrite issue: Nginx does not use
.htaccess, so rewrite rules must be handled in the server block. - Wrong internal links: Menus, buttons, CTAs, or old blog links point to outdated URLs.
- Cached 404 page: Browser, plugin, CDN, or server cache may keep showing an old 404 response.
Before You Start: Check the Scope of the 404 Error
Before changing anything, check how wide the problem is. This tells you whether you should fix permalinks, redirects, content, or server rules.
Check these cases:
- Only one URL is broken: Check the page slug, deletion status, internal link, and redirects.
- All posts are broken but homepage works: Check permalinks and
.htaccess. - Only WooCommerce products are broken: Check product permalinks, WooCommerce rewrite rules, and product slugs.
- Only custom post types are broken: Flush rewrite rules and inspect the custom post type registration code.
- Only media files are broken: Check file paths, uploads folder, CDN settings, and file permissions.
- Everything is broken including homepage: This may not be a normal 404 issue. Check hosting, DNS, document root, WordPress files, or server configuration.
If you have access logs or crawl logs showing many 404 URLs, you can review them with the FyrePress Server Log Analyzer to identify patterns before creating redirects.
Fix 1: Resave WordPress Permalinks
If your homepage works but posts, pages, products, or archives show 404, resaving permalinks is the fastest first fix. This forces WordPress to refresh its rewrite rules.
Steps:
- Log in to your WordPress dashboard.
- Go to Settings → Permalinks.
- Do not change anything yet.
- Click Save Changes.
- Open the broken URL in a private browser window and test again.
If the 404 error disappears, your rewrite rules were stale or missing. This often happens after migrations, plugin changes, custom post type updates, WooCommerce changes, or theme code edits.
External reference: WordPress explains permalink settings here: Customize Permalinks.
Fix 2: Reset the .htaccess File
On Apache and LiteSpeed hosting, WordPress uses .htaccess to handle pretty permalinks. If this file is missing or corrupted, WordPress may show 404 errors for posts and pages even when the content exists.
How to reset .htaccess safely:
- Open your hosting File Manager or connect with SFTP.
- Go to your WordPress root folder, usually
public_htmlor your domain directory. - Find the
.htaccessfile. - Download a backup copy.
- Rename
.htaccessto.htaccess-old. - Go to Settings → Permalinks in WordPress.
- Click Save Changes to regenerate the file.
.htaccess
.htaccess-old
Default WordPress .htaccess rules:
# 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 issue started after adding security rules, redirect rules, hotlink protection, bot blocking, or custom rewrites, review those rules carefully before adding them back.
External reference: WordPress explains how Apache uses .htaccess for pretty permalinks here: Apache HTTPD and .htaccess.
FyrePress tool: Use the FyrePress .htaccess Security Builder if you need clean WordPress-ready .htaccess rules for Apache or LiteSpeed.
Fix 3: Check Nginx Rewrite Rules
If your server uses Nginx, resaving permalinks will not create or update an .htaccess file because Nginx does not use .htaccess. WordPress permalink routing must be configured in the Nginx server block.
Common WordPress Nginx rule:
location / {
try_files $uri $uri/ /index.php?$args;
}
If posts and pages show 404 on Nginx, ask your hosting provider or server administrator to confirm that WordPress rewrite rules are correctly configured for your domain root. This is especially important after a migration from Apache/LiteSpeed to Nginx.
Related FyrePress guide: Nginx vs Apache for WordPress.
Fix 4: Check the Page, Post, or Product Slug
If only one URL shows 404, the permalink system may be fine. The problem may be the individual slug.
Check this:
- Open the page, post, or product in WordPress.
- Check the URL slug.
- Compare it with the broken URL.
- Look for spelling changes, extra words, missing hyphens, or date/category changes.
- Update the internal link or create a redirect from the old URL to the new one.
Example:
Old URL:
/best-wordpress-cache-plugin/
New URL:
/best-wordpress-cache-plugins/
In this case, the old URL should be redirected to the new URL if it has backlinks, traffic, or internal links.
Fix 5: Restore Deleted Content or Create a Redirect
If a page was deleted, unpublished, moved to draft, or replaced with a new URL, WordPress may correctly return 404. The fix is not always to recreate the same page. Sometimes the better fix is a relevant 301 redirect.
Use this decision:
- Content was deleted by mistake: Restore it from Trash or backup.
- Content was replaced: Redirect the old URL to the new matching page.
- Content is no longer relevant: Redirect only if there is a closely related page.
- No relevant replacement exists: Keep a proper 404 page instead of redirecting to the homepage.
Do not redirect every 404 to the homepage. That creates a poor user experience and may confuse search engines. Redirect only when the destination clearly matches the original user intent.
Fix 6: Add SEO-Friendly 301 Redirects
If old URLs have backlinks, rankings, social shares, or traffic, create a 301 redirect to the most relevant working URL. This helps users and search engines reach the correct content.
Good redirect examples:
| Old URL | Best Redirect Target | Why |
|---|---|---|
| /old-wordpress-speed-guide/ | /wordpress-speed-optimization-guide/ | Same topic, newer content |
| /plugin-review-old-name/ | /plugin-review-new-name/ | Same plugin, updated URL |
| /services/wordpress-fix/ | /wordpress-maintenance/ | Closely related service page |
Bad redirect examples:
- Redirecting all 404s to the homepage.
- Redirecting unrelated blog posts to a sales page.
- Redirecting deleted product pages to an unrelated product.
- Creating redirect chains with multiple hops.
If you use a redirect plugin, keep the rules organized and avoid duplicate redirects. If you use server-level redirects, keep a backup of your .htaccess or Nginx config before editing.
Related FyrePress guide: Best WordPress Redirection Plugins and When to Use Them.
Fix 7: Check Broken Internal Links
Sometimes the page exists, but your website links to the wrong URL. This often happens after changing slugs, restructuring categories, importing posts, switching page builders, or editing menus.
Places to check:
- Navigation menus
- Footer links
- Buttons and CTA sections
- Blog post internal links
- Breadcrumbs
- WooCommerce product tabs
- Elementor, Bricks, Divi, or block editor templates
- Sitemap links
Update internal links to point directly to the correct live URL. Do not rely on redirects for every internal link because that creates unnecessary redirect hops and slows crawling.
Fix 8: Clear WordPress, Server, and CDN Cache
After fixing permalinks, redirects, or rewrite rules, your cache may still show the old 404 response. Clear cache only after you make the actual fix.
Clear these layers:
- WordPress cache plugin cache
- Server cache from your hosting panel
- LiteSpeed Cache if your host uses LiteSpeed
- Object cache such as Redis or Memcached
- CDN cache such as Cloudflare
- Browser cache
Test the fixed URL in a private browser window and use an HTTP status checker if needed to confirm whether the URL now returns 200, 301, 302, 404, or another status code.
Related FyrePress guide: How to Speed Up WordPress Without Breaking It.
Fix 9: Check Custom Post Type 404 Errors
Custom post types can show 404 errors when rewrite rules are not flushed, the custom post type slug changes, or the code/plugin registering the post type is not loaded correctly.
Common custom post type causes:
- The custom post type slug was changed.
- The plugin that registered the post type was disabled.
- The theme registered the post type, then the theme was changed.
- Rewrite rules were not flushed after adding a custom post type.
- The custom post type has the same slug as a page, category, or taxonomy.
- The custom post type was registered too late in the WordPress load process.
What to do:
- Resave permalinks from Settings → Permalinks.
- Check whether the plugin or theme that registers the custom post type is active.
- Look for slug conflicts with pages, categories, tags, or taxonomies.
- If you added custom code, confirm the post type is registered on the correct hook.
- Clear cache and retest the custom post type URL.
Related FyrePress guide: WordPress Custom Post Types Guide.
Fix 10: Check WooCommerce Product 404 Errors
If WooCommerce product pages show 404 but normal posts and pages work, check product permalink settings and WooCommerce rewrite rules.
Steps:
- Go to Settings → Permalinks.
- Scroll to the WooCommerce product permalink section.
- Confirm the product base is correct.
- Click Save Changes.
- Clear cache and test a product URL.
Also check whether a page, category, product base, or custom post type is using the same slug. Slug conflicts can create confusing 404 errors.
Fix 11: Check Media File and Download 404 Errors
If images, PDFs, CSS, JavaScript, or downloads return 404, the issue may not be WordPress permalinks. It may be a missing file, wrong path, CDN issue, upload directory issue, or permissions problem.
Check these items:
- Does the file exist inside
wp-content/uploads? - Was the file moved, renamed, or deleted?
- Is the media URL using the correct domain?
- Did a migration miss the uploads folder?
- Is a CDN serving an outdated or incorrect path?
- Are folder permissions set correctly?
- Is hotlink protection blocking the file?
Typical permissions are 755 for folders and 644 for files, but hosting environments can vary. Avoid setting uploads or files to 777.
Fix 12: Check Your XML Sitemap and Search Console
If Google is finding many 404 URLs, check whether your XML sitemap includes outdated links. Your sitemap should only list canonical, indexable, working URLs.
Check this:
- Open your XML sitemap.
- Confirm it does not include deleted posts or old product URLs.
- Regenerate the sitemap from your SEO plugin if needed.
- Submit the updated sitemap in Google Search Console.
- Review 404 URLs in the Pages report and redirect only the URLs that have a relevant replacement.
External reference: Google Search Console can help site owners inspect indexing and page issues here: Google Search Console.
WordPress 404 vs Soft 404: What Is the Difference?
A normal 404 means the server clearly says the page is not found. A soft 404 happens when a page looks like an error page or empty page to users, but the server still returns a 200 OK status. Soft 404s can confuse search engines because the page appears technically successful even though it has no useful content.
| Issue | Meaning | Best Fix |
|---|---|---|
| 404 Not Found | The server says the URL does not exist | Restore page, update link, or redirect to a relevant page |
| Soft 404 | The page looks missing but returns 200 OK | Return proper 404/410 or improve/restore the page content |
| Redirected 404 | A missing URL redirects somewhere else | Use only if the destination is highly relevant |
For SEO, avoid thin “not found” pages that return 200 OK and avoid redirecting unrelated missing URLs to the homepage.
Best Fix Method by User Type
The best 404 fix depends on whether you are fixing a site-wide permalink issue, an individual broken URL, or SEO crawl errors.
For beginners
Start with Settings → Permalinks → Save Changes. If only one URL is broken, check whether the page was deleted, drafted, renamed, or moved.
For site owners with hosting access
Reset .htaccess, regenerate permalinks, check internal links, and create relevant 301 redirects for old URLs with traffic or backlinks.
For developers
Inspect rewrite rules, custom post type registration, taxonomy conflicts, Nginx config, Apache/LiteSpeed directives, canonical redirects, server logs, and HTTP status codes.
For WooCommerce stores
Check product permalinks, product base conflicts, deleted products, category slugs, variation URLs, and old product links from Google or ads. Redirect discontinued products only to close alternatives or relevant category pages.
For SEO-focused sites
Export 404 URLs from crawl tools and Google Search Console, group them by pattern, fix internal links first, then redirect valuable old URLs to relevant live pages. Leave truly irrelevant deleted URLs as proper 404 or 410 responses.
How to Prevent WordPress 404 Errors
The best way to avoid 404 errors is to manage URL changes carefully. Every time you delete, rename, migrate, or restructure content, think about what happens to the old URL.
Prevention checklist:
- Do not change live URLs without a redirect plan.
- Check internal links after changing slugs or categories.
- Resave permalinks after migrations, custom post type changes, or WooCommerce permalink changes.
- Keep a backup of your working
.htaccessfile. - Avoid duplicate slugs across pages, categories, products, and custom post types.
- Regenerate your sitemap after major content changes.
- Review Google Search Console regularly for important 404 patterns.
- Do not redirect all 404s to the homepage.
- Use staging before large permalink, migration, or site structure changes.
- Document old and new URL mappings during migrations.
Related FyrePress guide: Create a WordPress Staging Site Before Updates.
Final Recommendation
If your WordPress homepage works but other pages show 404, start by resaving permalinks and checking .htaccess. These two steps fix many site-wide WordPress 404 issues. If only one URL is broken, check the page slug, restore the page, update internal links, or create a relevant 301 redirect.
For SEO, be careful with redirects. Do not send every missing URL to the homepage. Restore valuable content when possible, redirect old URLs to the closest matching live page, and allow genuinely removed content to return a proper 404 or 410 when no useful replacement exists.
Frequently Asked Questions
Why does my WordPress homepage work but posts show 404?
This usually means WordPress permalink rewrite rules are missing or broken. Go to Settings → Permalinks and click Save Changes. If that does not work, reset the .htaccess file or check Nginx rewrite rules.
How do I fix WordPress 404 errors after migration?
Resave permalinks, reset .htaccess if you use Apache or LiteSpeed, check Nginx rewrite rules if your new server uses Nginx, update old internal links, and create 301 redirects for changed URLs.
Will resaving permalinks break my website?
Usually no. Resaving permalinks simply refreshes WordPress rewrite rules. However, if you change the permalink structure itself, old URLs may change, so avoid changing the structure without a redirect plan.
Should I redirect all 404 pages to the homepage?
No. Redirect only to a closely relevant replacement page. Sending every 404 to the homepage creates a poor user experience and may cause SEO problems.
Why are WooCommerce products showing 404?
WooCommerce product 404 errors are often caused by product permalink settings, stale rewrite rules, product base conflicts, changed slugs, deleted products, or cache. Resave permalinks and check product permalink settings first.
How do I fix custom post type 404 errors?
Resave permalinks, confirm the plugin or code registering the custom post type is active, check for slug conflicts, and make sure the custom post type is registered correctly before rewrite rules are flushed.
Are 404 errors bad for SEO?
A few normal 404s are not unusual. They become a problem when important pages, internal links, backlinks, sitemap URLs, product pages, or ranking pages return 404 without a useful replacement or redirect.
How can I find 404 errors on my WordPress site?
You can find 404 errors using Google Search Console, server access logs, SEO crawl tools, broken link checker tools, redirect plugins, and analytics data showing visits to missing URLs.