Web Design
WordPress Errors After Migration: Database Connection, White Screen and Broken Images
WordPress errors after a migration usually come from the database credentials in wp-config.php, old URLs left in the database, or the new server's settings. This guide covers the cause and fix for each symptom, a post-migration checklist and when to restore a backup instead.
By Mehmet ÇalışırPublished 14 min read

Contents
This guide is for business owners, freelancers and agency teams moving a WordPress site to a new host, a new domain or from a local environment to a live server. We covered the migration itself in our guide to migrating WordPress to a new host; here we go through the errors that tend to appear right after you think you're done, from symptom to cause to fix, so you know which file and which setting to check when things go wrong.
Why do WordPress errors appear after a migration?
A site migration means moving a website's files and database to a different server, domain or URL structure. In WordPress it touches three layers, and nearly every error comes from one of them still reflecting the old setup.
- Configuration: the database details, table prefix and constants in wp-config.php.
- Database content: old URLs and server paths stored in posts, settings and page builder data.
- Server environment: PHP version and memory limit, .htaccess or Nginx rules, SSL and proxy settings, scheduled tasks and email delivery.
The table below sums up the symptoms we see most often and where to look first.
| Symptom | Likely cause | First fix |
|---|---|---|
| Error establishing a database connection | Wrong name, user, password or host in wp-config.php; user lacks privileges | Compare the DB_ values with your panel; assign the user to the database |
| The install screen appears | $table_prefix doesn't match the imported tables | Fix the prefix; don't run the installer |
| White screen or "critical error" | PHP version, memory limit, an incompatible plugin or theme | Turn on WP_DEBUG_LOG; rename the plugins folder |
| Images and links point to the old site | Old URLs left in the database | Serialization-safe search and replace |
| No padlock, some files don't load | Mixed content: HTTP resources on an HTTPS page | Replace http URLs with https |
| Homepage works, posts return 404 | Rewrite rules, missing .htaccess | Re-save permalinks |
| Too many redirects | siteurl and home don't match; HTTPS not detected behind a proxy | Align the URLs; tell WordPress about HTTPS in wp-config |
| Broken layout, missing styles | Page builder CSS generated with the old URL | Regenerate CSS files and clear caches |

How do you fix "Error establishing a database connection"?
This message means WordPress can't reach the database server with the details in wp-config.php. After a migration it is almost always a mistyped value or a missing privilege, and your data is very likely still intact.
Check the four values in wp-config.php
Open the file and compare these four lines, character by character, with the details in your hosting panel:
DB_NAME: the exact name of the database you created on the new server. Shared hosts often prefix it with your account name, such asaccount_wpdb.DB_USER: the database user, which on most panels also starts with the account name.DB_PASSWORD: the user's password. Make sure no spaces crept in when pasting and that quote marks weren't mangled.DB_HOST: usuallylocalhoston shared hosting; some managed hosts use a separate hostname or a value with a port, such asdbserver:3306. Your panel or your host's support team will know.
A quick test: try logging in to phpMyAdmin with the same username and password. If that fails, the credentials are the problem; if it works, look at the WordPress side.
The user's database privileges
In panels like cPanel, creating the database and the user isn't enough; you also have to add the user to the database and grant it all privileges. It is one of the most commonly skipped steps in a migration, and the symptom is exactly this connection error.
Table prefix and the install screen
If the connection works but WordPress offers to install itself, the $table_prefix in wp-config.php doesn't match the prefix of the tables you imported: the tables are wp7_posts, say, while the prefix is still wp_. Don't run the installer; fix the prefix and reload. If you changed the prefix by hand, remember that the rows holding user roles need updating too, or your admin account may appear to have no permissions.
Damaged tables and the server side
If the message says one or more database tables are unavailable, temporarily add define( 'WP_ALLOW_REPAIR', true ); to wp-config.php and run the repair at /wp-admin/maint/repair.php; remove the line when you're done. If the credentials are right, the privileges are in place and the tables are healthy, the database server may be down or at its connection limit, which your host can check.
How do you fix the WordPress white screen?
A white screen, or the message "There has been a critical error on this website," means PHP stopped on a fatal error, and the first step is to get that error written down. After a migration, the usual suspects are a different PHP version, a low memory limit and a plugin or theme that doesn't get along with the new environment.

1. Turn on the error log
In wp-config.php, above the comment near the end that tells you to stop editing, add define( 'WP_DEBUG', true );, define( 'WP_DEBUG_LOG', true ); and define( 'WP_DEBUG_DISPLAY', false );. Errors are then written to wp-content/debug.log without being shown to visitors. Reload the page and read the last lines of the file: the error usually names the plugin or theme file responsible. The constants are explained in the WordPress documentation on debugging.
2. Check the PHP version and memory limit
If the old server ran an older PHP version and the new one runs a newer one, a plugin that hasn't been updated in years can throw a fatal error. Temporarily select the old version in your panel's PHP selector, get the site up, update your plugins, then move PHP up again. If the log says "Allowed memory size exhausted," add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php; it can't exceed the limit your host allows.
3. Find plugin and theme conflicts by renaming folders
If you can't get into the dashboard, use FTP or the file manager to rename wp-content/plugins to something like plugins-off; WordPress then loads without any plugins. If the site comes back, rename the folder back and activate plugins one at a time from the Plugins screen to find the culprit. If the plugins are innocent, do the same with the active theme's folder; WordPress falls back to a default theme if one is installed.
One more detail: a leftover .maintenance file in the root keeps the site on the "Briefly unavailable for scheduled maintenance" screen. If the site was copied mid-update, delete that file. And once the problem is solved, turn the error log off again.
How do you fix broken images, old links and mixed content?
When images and internal links break, the cause is almost always old URLs left in the database, and the fix is a search and replace that doesn't break serialized data. WordPress stores image and link addresses in content as full URLs, and they don't update themselves when you change the domain or protocol.
Why you shouldn't use plain SQL
Theme settings, widgets and many plugins store data in PHP's serialized format, which records the length of every string. In a value like s:22:"http://old-site.com/x", a plain SQL REPLACE changes the URL but not the length, PHP can no longer read the data, and your theme settings or widgets quietly reset. In Elementor and block editor data, URLs sit inside JSON with escaped slashes, as https:\/\/, so a simple search misses them.
The safe options:
- WP-CLI with a dry run first:
wp search-replace 'http://old-site.com' 'https://new-site.com' --skip-columns=guid --dry-run; if the result looks right, run it again without--dry-run. The options are documented on the WP-CLI search-replace page. - A serialization-safe search-and-replace plugin; prefer one that offers a dry run.
- A migration plugin that replaces URLs for you during the move.
We go deeper into URL replacement in our guide to changing a WordPress domain and moving to HTTPS, and into local ports and paths in our post on moving WordPress from localhost to a live server.
If images still don't show
If the URLs are right but images still fail to load, check that the wp-content/uploads folder was copied in full and that file permissions let the web server read it. Occasionally the upload_path option in the database holds the old server's full folder path; if it's filled in, clear it. URLs hard-coded in theme files won't show up in a database search either; fix those in the files.
Mixed content after HTTPS
Mixed content means a page loaded over HTTPS requests images, scripts or stylesheets over plain HTTP. Browsers may block those resources or stop showing the secure-connection icon. The browser's developer console lists each offending URL. Switch your own domain's http URLs to https with a search and replace, use HTTPS versions of external resources, and don't forget hard-coded URLs in theme and CSS files.
404s, redirect loops and other surprises
Once the database and images are sorted, what's left is usually down to server rules, URL settings and the background jobs WordPress runs. Each takes minutes to diagnose.
The homepage loads, posts return 404
This pattern means rewrite rules aren't working on the new server. Go to Settings > Permalinks and click "Save Changes" without changing anything. If that doesn't help, check the .htaccess file, which as a hidden file may not have been copied, mod_rewrite support on Apache and the try_files rule on Nginx. The full fix and permanent redirects are in our guide to WordPress redirects and 404 errors.
"Too many redirects"
If the browser reports too many redirects instead of loading the page, you have a redirect loop. After a migration, two causes stand out:
- siteurl and home don't match: the WordPress Address and Site Address in the database point to different protocols or domains. If you can't reach the dashboard, pin the values temporarily by adding the
WP_HOMEandWP_SITEURLconstants with the correct URL to wp-config.php. - HTTPS not detected behind a proxy or CDN: the visitor arrives over HTTPS but the proxy connects to the server over HTTP, so WordPress thinks the connection is insecure and redirects to HTTPS again. A CDN's "flexible" SSL mode, which talks to your server unencrypted, causes the same loop. Install a valid certificate on the server and switch the CDN to full encryption, or add
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) { $_SERVER['HTTPS'] = 'on'; }to wp-config.php.
After fixing it, clear your browser cache or test in a private window; browsers remember permanent redirects.
Logged out after the import
Methods that move the whole database also bring the users table from the source site. The account you created while installing WordPress on the target no longer exists, so log in with the source site's username and password. If the login page keeps looping back to itself, check that the address you're using matches siteurl exactly (including www and https) and clear your cookies.
Broken layouts in Elementor and other page builders
Page builders like Elementor generate separate CSS files in the uploads folder. If those files were built with the old URL, the layout looks broken. Use the regenerate CSS and data button on Elementor's Tools screen (its name varies between versions), then clear your caching plugin and any CDN cache.
Emails don't arrive, scheduled tasks don't run
The new server may restrict PHP's mail sending, or your domain's SPF record may not include the new server; set up SMTP again for form notifications. WordPress's scheduled tasks are triggered by visits by default; if the old server used DISABLE_WP_CRON with a real cron job, you need to set up the same job on the new server. Otherwise scheduled posts end up as "Missed schedule" and automatic backups don't run.
Step by step: a post-migration checklist
Right after the move, before the DNS change reaches everyone, work through this list in order so that you find the problems, not your visitors.

- Open the homepage, a post, a page and, if you have one, a product in a private window.
- Log in with the source site's credentials and check both URLs under Settings > General.
- Save Settings > Permalinks once.
- Review images, page builder layouts and menus; look for mixed content warnings in the console.
- Send a test message through the contact form and confirm the email arrives.
- Make sure "Discourage search engines from indexing this site" under Settings > Reading is not ticked; it is often left on when a site comes from staging.
- Clear caches and confirm the SSL certificate is valid on the new server.
- Take a first backup on the new server and set scheduled backups up again.
When should you stop fixing and restore a backup?
If the live site is down, you can't find the cause within an hour and you have a verified backup taken just before the migration, rolling back is usually the cheapest move. If you haven't switched DNS yet, the old server is still serving visitors, so you can fix the new one calmly without losing anything. Our WordPress backup and restore guide covers how to take and restore a backup.

Which of these errors does Doruva Migrate prevent?
Doruva Migrate is a free migration and backup plugin developed by Doruva, built to stop several of the errors above at the source. It is coming soon to WordPress.org.
- Archive verification: every block of the archive is checked with a checksum; a corrupt or half-downloaded file is rejected before your site is touched.
- Temporary tables: the database is imported into temporary tables first and goes live in one move at the end, so an interrupted import doesn't break the live database.
- Smart URL replacement: the old address is found as http and https, with and without www, protocol-relative, JSON-escaped and URL-encoded, and string lengths in serialized data are recalculated. The table prefix is adapted along with user roles and capability keys.
- Change summary: at the end you see which address became what and how many replacements were made in which tables. Permalinks, caches and Elementor CSS are refreshed automatically.
- Emergency restore script: if WordPress has crashed completely, a standalone script protected by a one-time password unpacks the archive, imports the database, writes wp-config.php and deletes itself.

Because users come from the archive, you log in with the source site's credentials after an import. The plugin is also clear about what it leaves alone: Base64-encoded data and root-relative links stay as they are, and multisite isn't supported in version 1.0. Features change between versions, so check the current list on the product page.
Common mistakes
Some post-migration problems are unavoidable, but these are almost always preventable:
- Not taking a backup before the move, or never testing that it actually restores.
- Replacing URLs with plain SQL or a text editor and breaking serialized data.
- Leaving the error log on and debug.log sitting in a publicly reachable folder.
- Reinstalling WordPress when the install screen appears, without checking the table prefix.
- Switching DNS before testing the migrated site, so the first visitors find the errors.
- Leaving the "discourage search engines" setting on from staging.
- Shutting down the old server before you're sure the new site works.
Summary and next steps
The shortcut to fixing post-migration errors is tying each symptom to the right layer: wp-config.php for connection errors, the error log for white screens, database URLs for broken images, and server rules and URL settings for 404s and loops. Make the checklist part of migration day and keep a verified backup within reach, and most problems are solved before visitors notice.
If you'd rather hand the migration and the checks that follow to a team, Doruva's web design service covers everything from setup to server moves, and you can also browse Doruva's other free WordPress plugins. To talk about your project, get in touch.
Frequently Asked Questions
Does a database connection error mean my data is gone?
Usually not. The message means WordPress can't connect to the database; after a migration it is mostly a wrong value in wp-config.php or a user that wasn't assigned to the database, and the data is still there.
Where is the debug.log file created?
With WP_DEBUG and WP_DEBUG_LOG enabled, errors are written to debug.log in the wp-content folder by default. Turn logging off and delete the file once you're done, as it can reveal details such as server paths.
Why can't I log in after migrating?
Methods that move the whole database bring the users over from the source site, so log in with the source site's username and password. If the login page keeps reloading, check that the URL you're using matches siteurl exactly.
Can I replace old URLs with SQL in phpMyAdmin?
It isn't recommended. A plain SQL replace breaks the length information in serialized data and can reset theme settings and widgets; use WP-CLI search-replace or a serialization-safe tool instead.
Do post-migration errors hurt SEO?
Short-lived errors rarely leave lasting damage, but 404s, redirect loops or a forgotten discourage-search-engines setting that persist for days can hurt visibility. That's why the checklist belongs before the DNS switch.




