11 WordPress ServicesView all
8 industry verticalsAll industries
12 UK locationsAll locations
Home/Blog/Troubleshooting
Troubleshooting9 November 2026· 5 min read

WordPress 404 Errors After Migration: Why Every Page Breaks and How to Fix It

You have just migrated your WordPress site to a new host and now every page except the homepage returns a 404 error. Here is why it happens and the exact steps to fix it.

You have just moved your WordPress site to a new host. The homepage loads fine but every other page — service pages, blog posts, contact — returns a 404 error. This is one of the most predictable post-migration problems, and in almost every case it is caused by a missing or incorrect .htaccess file on the new server, not by any problem with your content.

Why 404s appear after a WordPress migration

WordPress relies on Apache's mod_rewrite module to route all page requests through index.php. The routing rules are stored in .htaccess at the root of your WordPress installation. When you migrate to a new server, .htaccess may not transfer correctly, may be blocked by the new server's configuration, or the new server may not have mod_rewrite enabled — meaning WordPress cannot match any URL except the homepage.

Fix 1: Flush permalinks (try this first)

In your WordPress dashboard, go to Settings → Permalinks. Without changing anything, click Save Changes. This regenerates the .htaccess file with the correct rewrite rules for your current permalink structure. Load a few inner pages to test. This fixes the problem in the majority of post-migration 404 cases.

Fix 2: Manually restore the .htaccess file

If flushing permalinks does not work, connect to your server via FTP and check whether a .htaccess file exists in the root WordPress directory. If it is missing, create it. The standard WordPress .htaccess content is:

# 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

Fix 3: Update the site URL in the database

If your domain changed during the migration, WordPress still has the old domain hardcoded in the database. Go to phpMyAdmin in your hosting panel, open your WordPress database and find the wp_options table. Look for siteurl and home and update both to the new domain. Without this, WordPress redirects incorrectly regardless of your .htaccess.

Fix 4: Check mod_rewrite is enabled on the new server

If .htaccess looks correct but 404s persist, the new server may not have mod_rewrite enabled. Ask your hosting provider to enable it. On Nginx servers, .htaccess is not used at all — Nginx needs a try_files directive in the server block configuration. Contact your host if the server type changed during the migration.

ImportantIf the domain changed, also run a full database search-replace to update all hardcoded HTTP URLs. Use the Better Search Replace plugin to change every instance of the old domain to the new one across all database tables. Missing this causes broken images, incorrect canonical tags and mixed-domain internal links even after the 404s are resolved.

Frequently asked questions

Why does WordPress show 404 errors on all pages after a migration?+

The most common cause is that the .htaccess file on the new server does not contain the WordPress permalink rewrite rules, or the server does not have mod_rewrite enabled. Flushing permalinks in Settings → Permalinks regenerates the .htaccess file with the correct rules and fixes most post-migration 404 errors immediately.

How do I fix WordPress 404 errors after migrating to a new host?+

Go to Settings → Permalinks in your WordPress dashboard and click Save Changes without changing anything. This regenerates the .htaccess file. If 404s persist, check that your .htaccess file contains the WordPress rewrite block, and confirm mod_rewrite is enabled on your server — ask your host if you are unsure.

Why is only the homepage working after a WordPress migration?+

When only the homepage works and all inner pages return 404, it is almost always a permalink or .htaccess issue. WordPress uses mod_rewrite to route all requests through index.php. Without the correct .htaccess rules or with mod_rewrite disabled, only the root URL resolves correctly.

Do I need to update the site URL in the database after a WordPress migration?+

Yes, if the domain changed. Update the WordPress address and Site address in Settings → General. If admin is inaccessible, update wp_options in the database via phpMyAdmin — change the siteurl and home values to the new domain. Without this, WordPress redirects incorrectly regardless of your .htaccess configuration.

Related service

If you are migrating a WordPress site and want to avoid 404s, redirect failures and downtime, our migration service handles the full process — DNS, .htaccess, database and post-launch verification.

WordPress Migration Service →

Next article

Security

WordPress SSL and Mixed Content Errors: What They Mean and How to Fix Them

→
← All articles