How to Troubleshoot and Fix WordPress Permalinks Suddenly Returning 404 Errors Sitewide

Learn how to safely troubleshoot and fix WordPress permalink issues when all pages suddenly start returning 404 errors, without breaking your live site.

Overview: When All Your URLs Turn Into 404s

Sometimes a WordPress site that was working fine suddenly starts returning 404 errors on all or most pages and posts, even though you can still log into the dashboard. This is usually a permalink (URL structure) problem, not missing content.

This guide walks you through a safe, step-by-step process to diagnose and fix sitewide 404 errors caused by permalink issues.

Common Causes of Sitewide Permalink 404 Errors

Sitewide 404s usually appear after one of these changes:

  • Server or hosting migration
  • Switching from http to https (or vice versa)
  • Changing permalink structure in Settings ? Permalinks
  • Updating or installing security, caching, or redirection plugins
  • Manual edits to the .htaccess file on Apache servers
  • Incorrect Nginx rewrite rules

The good news: in most cases, you can fix this without touching your database or content.

Step 1 – Confirm It’s a Permalink Issue (Not Missing Content)

Before changing anything, confirm that your content still exists in WordPress.

1.1 Check Pages and Posts in the Dashboard

  1. Log in to WordPress: Dashboard ? Pages ? All Pages.
  2. Open a few key pages (e.g., Home, Contact) in the editor.
  3. Click View from the top admin bar to open them in a new tab.

If the editor loads fine but the front-end URL shows a 404, it’s almost certainly a permalink or rewrite issue.

1.2 Test the Admin Bar “View” Links

From the editor, use the View Page or View Post link. If that URL also returns 404, the problem is not the menu or a broken link; it’s how the server is handling pretty URLs.

Step 2 – Flush Permalinks from the WordPress Dashboard

Flushing permalinks forces WordPress to regenerate its URL rewrite rules. This is safe and often resolves the issue immediately.

2.1 Re-save Permalink Settings

  1. Go to Dashboard ? Settings ? Permalinks.
  2. Note your current setting (for example, Post name).
  3. Without changing anything, scroll down and click Save Changes.

2.2 If That Doesn’t Work, Temporarily Switch Structures

  1. On the same page, temporarily choose a different structure, such as Plain.
  2. Click Save Changes.
  3. Switch back to your preferred structure (for most sites, Post name).
  4. Click Save Changes again.

What You Should See

  • After re-saving, visit a few pages in a private/incognito window.
  • Pages that were previously 404 should now load normally.
  • Your menu links and internal links should work again without manual updates.

Step 3 – Check the .htaccess File (Apache Servers)

If you are on an Apache-based host and re-saving permalinks didn’t help, WordPress may not be able to write to your .htaccess file, or the file may be corrupted.

3.1 Locate .htaccess

Use your hosting file manager or an FTP/SFTP client:

  • Connect to your site’s files.
  • Open the public_html (or document root) folder.
  • Look for a file named .htaccess in the same folder as wp-config.php.

Tip: You may need to enable “show hidden files” to see .htaccess.

3.2 Back Up the Existing .htaccess

  1. Download a copy of .htaccess to your computer.
  2. Optionally, rename the server copy to .htaccess-backup so you can restore it if needed.

3.3 Add the Default WordPress Rewrite Rules

Create a new .htaccess file in the same directory with this content (for a standard WordPress install in the web root):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Save the file, then return to Settings ? Permalinks and click Save Changes once more.

What You Should See

  • Reload a few pages that were returning 404.
  • If the issue was a corrupted or missing .htaccess, they should now load correctly.
  • If not, continue to the next step.

Step 4 – Check for Conflicts with Security, Caching, or Redirect Plugins

Some plugins modify rewrite rules or redirects and can accidentally break permalinks.

4.1 Temporarily Disable Likely Plugins

From Dashboard ? Plugins ? Installed Plugins, temporarily deactivate:

  • Security plugins (firewalls, login protection)
  • Caching plugins
  • Redirection or SEO plugins that manage redirects
  • Custom routing or multilingual plugins

After deactivating, re-save permalinks again in Settings ? Permalinks and test your pages.

4.2 Re-enable Plugins One by One

If permalinks start working after deactivation:

  1. Re-enable plugins one at a time.
  2. After each activation, test a few URLs in a new incognito window.
  3. When 404s return, you’ve found the conflicting plugin.

Check that plugin’s settings for redirect rules or URL rewriting, or contact the plugin developer/your web team.

Step 5 – Verify Server-Level Rewrite Configuration (Nginx or Custom Setups)

If your host uses Nginx or a custom stack, permalinks may rely on server configuration files instead of .htaccess.

5.1 Ask Your Host to Confirm Rewrite Rules

Open a support ticket with your hosting provider and include:

  • A description of the issue: “All pretty permalinks return 404, but /?p=123 works.”
  • A link to an example 404 URL and the corresponding page in the dashboard.
  • A request to confirm that the server is configured with standard WordPress rewrite rules.

Most managed WordPress hosts can fix this quickly at the server level.

5.2 Test a Plain URL

To confirm it’s a rewrite problem and not a missing page:

  1. Note the ID of a post or page (hover over the title in Pages ? All Pages and look for post=123 in the URL).
  2. Visit https://yourdomain.com/?p=123 (replace 123 with your ID).

If that loads while https://yourdomain.com/sample-page/ does not, the database and content are fine; only the rewrite layer is broken.

Step 6 – Check for Conflicting Custom Code or Child Theme Functions

Occasionally, custom code in a theme or plugin can interfere with permalinks.

6.1 Temporarily Switch to a Default Theme

  1. Go to Dashboard ? Appearance ? Themes.
  2. Activate a default theme such as Twenty Twenty-Five.
  3. Re-save permalinks and test your URLs.

If permalinks work with the default theme, the issue may be in your theme’s functions.php or custom routing code.

6.2 Look for Custom Rewrite or Redirect Code

Ask your developer or web team to review:

  • functions.php in your active theme or child theme
  • Any custom plugin that handles URLs, slugs, or redirects
  • Code that uses add_rewrite_rule(), add_rewrite_tag(), or wp_redirect()

What You Should See When It’s Fixed

Once the permalink issue is resolved:

  • All existing pages and posts load at their normal URLs without 404 errors.
  • Your main navigation menu links work as expected.
  • Category and tag archive pages load correctly.
  • Custom post type URLs (if used) also work.

Always test in an incognito/private window and, if you use caching, clear both your WordPress and server/host cache before final verification.

Preventing Future Permalink Breakages

To reduce the chance of this happening again:

  • Avoid editing .htaccess directly unless you know exactly what you’re doing.
  • Limit the number of plugins that manage redirects or URL rules.
  • Document your current permalink structure and server environment before migrations.
  • After major updates or migrations, immediately test a few key URLs.

When to Contact Compass Production or Your Developer

Reach out for professional help if:

  • Re-saving permalinks and restoring .htaccess did not resolve the issue.
  • You suspect Nginx or server-level configuration problems.
  • Your site uses complex custom post types, multilingual routing, or advanced redirect logic.

Provide a list of example URLs that fail, a description of recent changes (plugins, migrations, SSL), and any error messages from your host. This will help your support team resolve the issue faster and with less risk to your live site.

Video

Leave a Reply

readers also liked

Need Help With Your Website?

If you’re reading this because you’re planning a website—or trying to improve one—you don’t have to guess your way through it.

I offer a free 30-minute consultation where we’ll talk through your goals, your budget, and the most efficient way to get a professional website online.

Whether you need full website design, help choosing the right platform, guidance on hosting, or a clear plan you can execute yourself, I’ll give you direct, practical advice tailored to your situation.

Even if you don’t move forward with my services, you’ll leave the call knowing exactly what your next step should be.

Give us a call at
(208) 449-4466

Or give us your info and we will call you.

Give us a call at (208) 449-4466
Or give us your info and we will call you.

Get a Quote/Contact Form
By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Report an Issue

Flag incorrect info, broken media, or unclear steps. we review every report.

You’re reporting: {Post Title}

Content Report

By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Request a New Topic

Suggest a tutorial, guide, or course idea you’d like to see added. I review every submission.

Topic Request (Knowledge Base)

By submitting this form, you acknowledge that you have read and agree to our Privacy Policy and Terms & Conditions.

Websites That Work as Hard as You Do

Are you ready to grow your business?
Call (208) 449-4466 or schedule an in-person meeting today.