WordPress Troubleshooting & Fixes

How to Fix Error 404 on All Pages

blog-post-banner

WordPress Troubleshooting & Fixes

How to Fix Error 404 on All Pages in WordPress

Are all your WordPress pages or posts showing a 404 Not Found error? Does the homepage work, but all inner pages show 404? This is a common issue caused by permalinks, .htaccess corruption, plugin conflicts, or server rewrite problems. Here’s the complete fix.

1

Why WordPress Pages Show 404 Errors

404 does not mean your content is gone — only URLs are broken.

Your posts/pages still exist; WordPress simply cannot find the rewrite rules to load them.

Common causes:

  • Corrupted .htaccess file (most common)
  • Wrong permalinks structure
  • Server rewrite module disabled
  • Plugin forcing redirects
  • Incorrect domain or URL settings
  • Multisite rewrite issues
  • Hosting migration issues

Let’s fix all of them step-by-step.

2

Step 1: Reset Permalinks (The Fastest Fix)

Most 404 issues disappear instantly after resetting permalinks.

Steps:

  1. Go to Settings → Permalinks
  2. Choose any structure temporarily (default)
  3. Click Save Changes
  4. Select your preferred structure again (Post Name)
  5. Click Save Changes again

This automatically regenerates new rewrite rules.

3

Step 2: Regenerate a Fresh .htaccess File

Corrupted .htaccess = broken URLs = 404 errors.

Steps:

  1. Go to public_html
  2. Find .htaccess
  3. Rename it to .htaccess-old
  4. Go to Settings → Permalinks
  5. Click Save Changes

WordPress will create a clean .htaccess file with correct rewrite rules.

Correct default .htaccess:


# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
    

4

Step 3: Check if Apache mod_rewrite Is Enabled

Without mod_rewrite, pretty permalinks will not work.

Ask your hosting support:

  • Is mod_rewrite enabled?
  • Can they enable the Apache Rewrite module?

If you’re on VPS/cloud hosting, enable it manually:


sudo a2enmod rewrite
sudo systemctl restart apache2
    

This immediately fixes 404 errors for Apache servers.

5

Step 4: Fix Wrong WordPress & Site URL

Incorrect URLs cause rewrite mismatches.

Check URLs at:

  • Settings → General

Both should match exactly:

https://yourdomain.com

Common mistakes:

  • Using http instead of https
  • www vs non-www mismatch
  • Extra slash or subfolder

If locked out of admin, set via wp-config.php:


define('WP_HOME', 'https://yourdomain.com');
define('WP_SITEURL', 'https://yourdomain.com');
    

6

Step 5: Disable Plugins Causing Redirect or Rewrite Issues

Some plugins override or break URL rules.

Plugins that often cause 404 errors:

  • Redirect plugins
  • Security plugins (Wordfence, AIOS, iThemes)
  • Cache plugins creating stale rules
  • Migration/clone tools
  • Language translation plugins
  • Custom post type plugins

Disable all plugins temporarily and test again.

If 404 errors disappear → re-enable plugins one-by-one.

7

Step 6: Check File Permissions

WordPress must be able to write .htaccess.

  • Folders → 755
  • Files → 644

Specially check:

  • /public_html/
  • /wp-content/
  • .htaccess

If permissions are wrong, WordPress cannot update URL rules.

8

Step 7: Fix NGINX Rewrite Rules

NGINX does not use .htaccess — it needs manual rules.

Add this to nginx.conf:


location / {
    try_files $uri $uri/ /index.php?$args;
}
    

Then restart NGINX.


sudo systemctl restart nginx
    

9

Step 8: Fix Multisite (Subdirectory & Subdomain) Rewrite Issues

Multisite needs special rewrite rules.

For subdirectory multisite:


RewriteBase /  
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
    

For subdomain multisite:


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule . index.php [L]
    

Incorrect multisite rules = instant 404 errors.

10

Step 9: Disable Cache, CDN & Security Layers

Sometimes cached or broken redirects cause 404s.

Clear/purge:

  • WordPress cache
  • Browser cache
  • Cloudflare cache
  • Server cache (LiteSpeed / NGINX)

Then retry opening the URLs.

Want 100% Working URLs Without 404 Errors?

All SiteCrafted ready-made websites come with fully optimized permalinks, .htaccess rules, CDN configuration, and strong hosting setups to avoid URL issues forever.

Get a Fully Fixed Website

Leave a Reply

Your email address will not be published. Required fields are marked *