WordPressMigrationUpdated for 2026

WordPress Site Broken After Migration

IN
Reviewed by the Instant Nerds Team|Last updated: June 2026
Quick summary

Moving a WordPress site to a new host or domain breaks it in a small set of predictable ways, and almost all of them come down to the database still holding the old URLs and credentials. The first thing to rule out is the most common false alarm: that you are debugging the old server because DNS has not propagated. After that, the real causes are the database URLs needing a careful, serialization-aware search-replace, the wp-config database credentials still pointing at the old host, the WordPress Address and Site Address being wrong, broken permalinks from a missing .htaccess, and mixed content from old http links. This page walks each one, and explains the serialized-data trap that turns a simple URL change into reset widgets and theme options.

Key facts at a glance

WordPress migration recovery in 2026

Last updated

Rule this out first
That you are seeing the old server. DNS can take up to a day to propagate, and caches hold the old site, so the broken page may not be your new migration at all. Test via the new host temporary URL or a hosts-file entry.
The core problem
The database still holds the old domain and the old credentials. Most migration breakage is the URLs, the wp-config database details, and the site address all needing to point at the new location.
The trap that resets your settings
A raw SQL find-and-replace of the old URL corrupts serialized data, because the character-length counts no longer match, so widgets and theme options silently revert to defaults. Always use a serialization-aware tool.
The right way to change URLs
WP-CLI wp search-replace with SSH, or the Better Search Replace plugin without it. Both recalculate serialized lengths correctly. Dry-run first, back up first.
The 404-on-everything cause
Permalink rewrite rules did not survive the move, usually because the hidden .htaccess file was not copied. Re-save permalinks to regenerate them.
Locked out of the admin
If the admin redirects to the old or staging domain, set WP_HOME and WP_SITEURL in wp-config.php. They override the database and get you back in to finish the fix.

Source: the WP-CLI search-replace documentation, the Better Search Replace plugin, the WordPress documentation on changing the site URL and moving WordPress, the WP Engine reference on serialized data, and our hands-on migration repairs. Get a quote in 60 seconds →

Why migrations break WordPress

A WordPress site is not just files, it is files plus a database, and the two have to agree about where the site lives and how to reach the database. A migration moves both to a new place, and breakage happens wherever something still refers to the old place. The files carry the code, but the database carries the site address, every internal link and image path saved in your content, the widget and theme settings, and the connection details WordPress uses. Move the site without updating those references and WordPress keeps trying to behave as if it were still on the old host at the old domain.

That is why the same handful of problems show up after almost every migration. The database still contains the old URLs, so links and assets point at the old domain. The wp-config.php file still has the old database credentials, so WordPress cannot connect to the new database. The stored WordPress Address and Site Address still name the old domain, so the admin redirects you away. The rewrite rules that power permalinks did not come across, so inner pages 404. And if the move also switched to https, the old http URLs in the content trigger mixed-content warnings. None of these is mysterious once you see the pattern: the new home, the old references.

The one genuine subtlety, and the thing that turns a routine migration into a mess, is how those old URLs get updated. Because WordPress stores many settings as serialized data, you cannot simply find-and-replace the old domain in a database dump or with a SQL query. Do that and you corrupt the settings. The correct fix is a tool that understands the serialized format, and getting that one detail right is most of the difference between a clean migration and a broken one.

First, make sure it is really broken

Before you change a single file, rule out the most common false alarm, because a large share of post-migration panics are not broken sites at all. When you point a domain at a new host, the change does not take effect everywhere at once. DNS, the system that maps your domain to a server, propagates gradually, and during that window some visitors, and possibly you, still reach the old server. On top of that, your browser cache, a caching plugin, and any CDN can keep serving the old version well after DNS has updated. So the broken or unchanged site in front of you may be the old server, not the migration you just finished.

How to check the new server directly

Load the site through the temporary URL or preview address the new host gives you, which bypasses DNS entirely. Or add a line to your computer hosts file mapping your domain to the new server IP address, so only your machine resolves the domain to the new host while you test. If the site is fine through the temporary URL or the hosts-file override, the migration worked and you are simply waiting on DNS and caches, so there is nothing to fix. If it is broken there too, then it is a real migration problem, and the causes below apply.

Which symptom matches yours

Find the row that matches what you see. Each one points to a specific cause and fix.

SymptomMost likely root cause
The migrated site still shows the old content or versionYou are probably seeing the old server. DNS has not propagated, or a browser or CDN cache is holding the old site. Test via the new host temporary URL or a hosts-file entry before debugging.
Widgets, menus, or theme options reset to defaultsSerialized data was corrupted by a raw SQL find-and-replace of the old URL. Restore the database and re-run the URL change with a serialization-aware tool.
Error establishing a database connectionThe wp-config.php database credentials are still the old host. Update the database name, user, password, and host to the new host values.
Every page 404s except the homepageThe permalink rewrite rules did not survive the move, often because the hidden .htaccess file was not copied. Re-save permalinks to regenerate them.
The admin redirects to the old or staging domain, or you cannot log inThe WordPress Address and Site Address still point at the old URL. Set WP_HOME and WP_SITEURL in wp-config.php to get back in, then run the full search-replace.
Styling and images are broken, or the browser shows Not SecureMixed content. Old http URLs are hardcoded in the database while the new site is https. Search-replace http to https across the database and install SSL.
White screen or critical error across the whole siteA failing database connection, a PHP version mismatch on the new host, or files that did not transfer. Enable the debug log to get the named cause.

The six root causes

Once you have confirmed you are on the new server, post-migration breakage is almost always one of these six.

1. The database still holds the old URLs

Your posts, options, and settings are full of the old domain, saved as absolute URLs in links, image sources, and configuration. Until those are replaced with the new domain, the site keeps pointing at the old location, which shows up as broken images, links to the old site, and assets that fail to load. The fix is a search-replace of the old URL to the new one across the whole database, done with a serialization-aware tool so it does not corrupt anything. This is the single most important step in any migration, and the next section explains why it has to be done carefully.

2. The wp-config database credentials are the old host

If you see Error establishing a database connection, the wp-config.php file still has the old database name, user, password, and host. The new host issues new values, and the database host in particular is often not localhost but a specific hostname you get from the new control panel. Update the four database constants in wp-config to match the new host, and the connection succeeds, provided the database was actually imported and the user has access to it.

3. The WordPress Address and Site Address are wrong

WordPress stores the site address in the database, and if it still names the old or staging domain, the admin redirects you there and you may be unable to log in. The reliable fix is to set the address directly in wp-config.php with the WP_HOME and WP_SITEURL constants, which override whatever is in the database and get you back into the admin. From there you can complete the full search-replace so the database itself is correct.

4. Broken permalinks from a missing .htaccess

When the homepage loads but every other page 404s, the permalink rewrite rules did not come across. On Apache the cause is usually that the .htaccess file, which is hidden and frequently skipped by file transfers, was not copied. Re-saving permalinks in Settings then Permalinks regenerates the rules and the .htaccess block. On Nginx, the server configuration needs the standard rule that passes requests to index.php.

5. Mixed content after moving to HTTPS

If the migration also moved the site to https, old http URLs hardcoded in the database make the browser load some resources insecurely, which breaks the padlock and often the styling. The fix is the same search-replace, this time from the old http address to the new https address, so every asset URL becomes https, combined with a valid SSL certificate on the new host and a redirect from http to https.

6. A white screen from PHP, files, or the database

A blank screen or critical error after a move is usually a failing database connection, a PHP version on the new host that an older plugin or theme cannot run on, or files that did not transfer completely. The debug log names which. A common version of this is the new host running a newer PHP than the old one, which can surface fatal errors in outdated plugins, covered in our PHP version fix. Missing files are resolved by re-running the transfer, including the hidden ones.

The serialized-data trap

This is the detail that separates a clean migration from a broken one, and it is worth understanding even if you never touch the database yourself. WordPress stores a lot of settings as serialized data, a text format that packs an array or object into a single string. The catch is that the format records the exact character length of every value. A piece of serialized data that contains https://oldsite.com also stores the number 19, the length of that string, right next to it.

Now do a blind find-and-replace, swapping https://oldsite.com for https://my-new-domain.com. The text changes, but the stored length still says 19 when the new value is longer. WordPress reads the length, expects 19 characters, finds a different number, and decides the whole serialized string is invalid. It does not error loudly. It quietly discards that setting and uses the default. That is why a raw SQL replace or a hand-edited database export so often comes out the other side with reset widgets, blank theme options, and lost plugin configuration, while the URLs in your posts look fine.

The rule that avoids it

Never run a raw SQL find-and-replace on a WordPress database, and never hand-edit URLs in a database dump. Use a serialization-aware tool that recalculates the length counts as it replaces: the WP-CLI search-replace command if you have SSH, or the Better Search Replace plugin if you do not. Both do it correctly. If your settings are already reset, the data is corrupted and the clean path is to restore the database from before the bad replace and do it again the right way.

DIY vs hand it off

A single clear cause with access to the files and database is a reasonable self-fix. A corrupted database, a lockout, or several issues at once is where handing it off saves time. If the left column matches you can likely do this. If the right column matches, get help.

Realistic on your own

  • The fix is updating wp-config database credentials
  • Re-saving permalinks resolves the 404s
  • You can run WP-CLI or install Better Search Replace for the URL change
  • You confirmed the issue is real and not just DNS or caching
  • You have a database backup from before any changes
  • Only one symptom, with a clear cause from the table above

Hand it off, save the time

  • A raw find-and-replace already reset your settings and there is no clean backup
  • The admin redirects to the old domain and you cannot get in
  • You have several symptoms at once and cannot tell where to start
  • The new host runs a newer PHP and plugins are now fataling
  • The database did not import cleanly or is partially corrupted
  • The site is a store and every hour down is lost orders

How to diagnose it

Work in this order. The first step prevents the most common wasted hour.

1
Confirm you are on the new server

Load the site through the new host temporary URL, or add a hosts-file entry pointing the domain at the new server IP. If it looks fine there, the migration worked and you are only waiting on DNS and caches, so stop here.

2
Check for a database connection error

If the page says Error establishing a database connection, open wp-config.php and confirm the database name, user, password, and host match the new host values, not the old ones.

3
Check the WordPress Address and Site Address

If the admin redirects to the old or staging domain, the stored site address is wrong. Set WP_HOME and WP_SITEURL in wp-config.php to the new domain to regain access.

4
Test the inner pages

If the homepage works but other pages 404, it is the permalink rewrite rules. Go to Settings then Permalinks and Save Changes, and confirm .htaccess exists in the site root.

5
Look for old URLs and mixed content

Broken images, links to the old domain, or a Not Secure warning mean the database still has old URLs. Plan a serialization-aware search-replace, including http to https if you moved to SSL.

6
Read the debug log for a white screen

For a blank screen, enable WP_DEBUG and WP_DEBUG_LOG in wp-config.php with display off, reload, and read wp-content/debug.log for the named fatal, often a PHP version or missing-file issue.

How to fix it

Each branch stands alone. Pick the one your diagnosis pointed to. Back up the database before any search-replace.

Update the database credentials

Open wp-config.php on the new server and set the four database constants to the new host values.

define( 'DB_NAME', 'new_database_name' );
define( 'DB_USER', 'new_database_user' );
define( 'DB_PASSWORD', 'new_database_password' );
define( 'DB_HOST', 'new_database_host' ); // often NOT localhost

Update the URLs the right way

With SSH, use WP-CLI, which handles serialized data and every table. Dry-run first to preview the count.

# Preview the change without writing anything
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables --dry-run

# Run it for real, skipping the guid column that should stay stable
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables --skip-columns=guid

Without SSH, install the Better Search Replace plugin, enter the old and new URLs, select all tables, run a dry run, then commit. Do not use a SQL query or edit a database dump by hand.

Force the site address to get back into the admin

If you are locked out because the admin redirects to the old domain, add these to wp-config.php. They override the database values immediately.

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

Log in, run the full search-replace so the database is correct, then you can remove these two lines.

Regenerate permalinks for the 404s

Go to Settings then Permalinks and click Save Changes to regenerate the rewrite rules. If .htaccess is missing or not writable on Apache, restore the default block by hand.

# 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

Settings already reset, locked out, or facing several issues at once?

Let us fix it in 2 hours →

A real migration-recovery session

A composite from the migration repairs we run most weeks, with identifying details removed.

Scenario

A business moved its site from a staging subdomain to the live domain. The homepage loaded but every inner page 404d, the carefully built homepage widgets were gone, and the theme had reverted to default colors and fonts. The person who did the move had updated the URLs by opening the database export in a text editor and running find-and-replace.

Diagnosis

Two separate problems. The lost widgets and theme options were classic serialized-data corruption: the hand-edited find-and-replace had changed the staging URL to the live URL in the serialized settings without fixing the length counts, so WordPress had discarded them. The 404s were the missing .htaccess, which the file transfer had skipped because it was hidden. The URLs in the posts themselves were fine, which is why it looked like only the settings broke.

Resolution

We restored the database from the export taken before the bad find-and-replace, then re-ran the staging-to-live URL change with WP-CLI search-replace, which rebuilt the serialized settings correctly, so the widgets and theme options came back. We re-saved permalinks to regenerate .htaccess and the inner pages resolved. A final check for any lingering staging URLs came back clean.

Total elapsed
Fully restored inside the 2-hour window, once the URL change was redone the serialization-safe way.

When to stop and hand it off

Four situations where DIY costs more than help. First, a raw find-and-replace already reset your settings and you do not have a clean backup from before it, which needs careful reconstruction rather than another replace. Second, the admin redirects to the old domain and the usual wp-config override is not getting you back in. Third, the new host runs a newer PHP than the old one and plugins are now throwing fatals, which is a compatibility problem layered on top of the migration. Fourth, you have several symptoms at once and cannot tell which to fix first. We confirm you are on the new server, fix the credentials and URLs the serialization-safe way, restore corrupted settings where a backup allows, regenerate permalinks, and resolve any PHP or file issues. Flat $49 to $149, done in two hours when scope fits, money back if we cannot.

Get a quote in 60 seconds

WordPress migration FAQ

My WordPress site broke right after I moved it to a new host. What is the first thing to check?

Before anything else, confirm you are actually looking at the new server and not the old one. When you change hosts, the domain keeps pointing at the old server until DNS propagates, which can take anywhere from minutes to a day, and your browser and any caching layer can hold the old version even longer. So the broken site you are debugging may be the old server, or a cached copy, not the migration you just did. Load the site through the new host temporary URL, or add a hosts-file entry on your computer that points the domain at the new server IP, and check there. A surprising number of post-migration emergencies are not broken sites at all, they are people debugging the old server while the new one is fine. Once you are certain you are on the new server, then the real causes are URLs, database credentials, permalinks, and mixed content.

After migration my widgets, menus, or theme options reset to defaults. What happened?

This is the classic sign that someone updated the database URLs with a raw find-and-replace, usually a SQL query or a text edit of a database export, and corrupted the serialized data. WordPress stores a lot of settings, including widget configuration, theme options, and some plugin data, as serialized arrays, which are strings that include the exact character length of each value. The old domain and the new domain are almost always different lengths, so a blind find-and-replace changes the text but not the length count, which makes the serialized string invalid, and WordPress silently falls back to defaults for that setting. The fix is to never do a raw find-and-replace on a WordPress database. Use a serialization-aware tool instead, the WP-CLI search-replace command, or a plugin like Better Search Replace, which recalculates the length counts correctly. If the data is already corrupted, the clean path is to restore the database and re-run the replacement the right way.

How do I correctly update the URLs after a migration or domain change?

Use a tool that understands serialized data, not a SQL find-and-replace. With SSH access, the WP-CLI command is the gold standard: run wp search-replace with the old URL and the new URL, ideally with a dry run first to preview the count, and it handles serialized data and every table correctly. Without SSH, install the Better Search Replace plugin or a similar serialization-aware plugin, enter the old and new URLs, select all tables, and run a dry run before committing. Replace the full URL including the protocol, for example the old https address with the new https address, so links and asset paths update together. It is also good practice to skip the guid column, which is meant to stay stable, and to take a database backup first so the operation is reversible. Done this way, the URLs update across posts, options, and serialized settings without breaking anything.

I get Error establishing a database connection after moving hosts. Why?

Your wp-config.php file still has the database credentials from the old host, and they do not match the new one. When you migrate, the new host gives you a new database name, database user, password, and often a different database host value, and WordPress cannot connect until wp-config.php is updated to match. The database host in particular trips people up, because many hosts do not use localhost, they use a specific hostname or address you have to get from the new host control panel. Open wp-config.php on the new server, update the four database constants to the values the new host provided, and the connection error clears. If the credentials look right and it still fails, confirm the database was actually imported into the new host and that the database user has permission to access it.

Every page gives a 404 except the homepage after migration. How do I fix that?

The homepage works because it does not depend on the permalink rewrite rules, but every other page does, and those rules did not survive the move. On Apache servers this usually means the .htaccess file, which is hidden, was not copied during the migration, or the rewrite rules need regenerating. The quick fix is to log in to wp-admin, go to Settings then Permalinks, and click Save Changes without altering anything, which forces WordPress to regenerate the rewrite rules and rewrite the .htaccess block. If .htaccess is not writable, restore the default WordPress rewrite block by hand. On Nginx there is no .htaccess, so the server configuration needs the standard rule that passes requests through to index.php. Once the rewrite rules are back, the inner pages resolve.

After moving to HTTPS my site shows Not Secure or the styling is broken. Why?

The site is loading some resources over plain http on an https page, which is mixed content, and it breaks the padlock and often the layout. This happens after a migration when the old URLs in the database were http and the new site is https, so stylesheets, scripts, and images are still requested from http addresses hardcoded in your content and settings. The fix is the same serialization-aware search-replace used for the domain change, replacing the old http address with the new https address across the database, so every asset URL updates to https. You also need a valid SSL certificate installed on the new host, which most provide free, and it is worth adding a redirect so any remaining http request is sent to https. Once the database URLs are https and the certificate is in place, the mixed-content warnings clear.

I migrated from a staging site and now the live site points back at the staging URL. What do I do?

The staging domain is baked into your database, so the live site keeps generating links, redirects, and asset paths using the staging URL until you replace it. It is the same problem as any domain change: run a serialization-aware search-replace from the staging URL to the live URL across the whole database, using WP-CLI or Better Search Replace, never a raw SQL replace. If the admin itself is redirecting you to the staging domain and you cannot log in, set the WordPress Address and Site Address directly in wp-config.php with the WP_HOME and WP_SITEURL constants, which override the database values and get you back into the admin, then run the full search-replace. Staging-to-live is one of the most common migration messes, and it is entirely fixable once the URLs are corrected the right way.

The whole site is a white screen after migration. Where do I start?

A white screen or critical error after a move is usually one of three things: a database connection that is failing, a PHP version on the new host that an older plugin or theme cannot run on, or files that did not transfer completely. Start by enabling the debug log, set WP_DEBUG and WP_DEBUG_LOG in wp-config.php with display off, reload once, and read wp-content/debug.log, where the most recent fatal names the file and points at the cause. If it is a database connection error, fix the wp-config credentials. If it is a PHP fatal in a plugin or theme, the new host may be on a newer PHP version than the old one, which is a compatibility problem we cover separately. If files are missing, re-run the file transfer, paying attention to hidden files like .htaccess that many transfers skip. The log turns the blank screen into a named, fixable cause.

Sources and further reading

Every technical claim on this page traces back to the WP-CLI documentation, the WordPress documentation, or the named plugin and host references.

Why we recover migrations faster than starting over

2h

2-Hour Guarantee

Fixed in 2 hours or your money back. We know exactly where migrations break and fix it in order.

$49

Flat Rate $49 to $149

No hourly billing. The URL change done right, credentials, permalinks, and mixed content.

100%

Money-Back Guarantee

Cannot fix it? You do not pay. Zero risk to you.

Get your migrated site working

We recover broken WordPress migrations every week, fixing the URLs the serialization-safe way and everything else the move left behind. Flat $49 to $149, done in 2 hours when scope fits, money back if we cannot.

Fix My Migration Now