Moving your WordPress site to a different domain — rebrand, consolidating from multiple domains, switching from .dev to .com after launch — requires updating the site's URL settings and search-replacing old URLs in the database.
The pieces involved
Three places store the site's URL:
- WordPress options table —
siteurlandhomesettings (visible inwp-admin → Settings → General). - Content — your posts, pages, custom fields. Old URLs in image references, links, etc.
- Database tables — some plugins store URLs in serialized data (e.g., widget settings, theme options).
All three need updating.
Easiest: Search-Replace plugin
For most sites:
- Install Better Search Replace plugin (free).
- Go to Tools → Better Search Replace.
- Configure:
- Search for: old URL (e.g.,
https://olddomain.com). - Replace with: new URL (e.g.,
https://newdomain.com). - Select tables: all of them (or at least
wp_options,wp_posts,wp_postmeta,wp_options). - Run as dry run first — see what would change without committing.
- Search for: old URL (e.g.,
- Run the dry run, review, then run for real.
The plugin handles serialized data correctly — replacing strings inside serialized arrays without breaking them. This is the key thing distinguishing it from raw SQL search-replace.
Update siteurl and home
After the search-replace runs, also update these explicitly:
wp-admin → Settings → General:
- WordPress Address (URL):
https://newdomain.com - Site Address (URL):
https://newdomain.com
These should match what the search-replace updated. If you ran a comprehensive search-replace, they're likely already correct.
Manual: wp-cli
For developer-friendly sites with shell access:
cd /home/your-user/public_html
# Update siteurl and home
wp option update home 'https://newdomain.com'
wp option update siteurl 'https://newdomain.com'
# Search-replace across all content (handles serialized data)
wp search-replace 'olddomain.com' 'newdomain.com'
# Flush rewrite rules
wp rewrite flush
The wp search-replace command is wp-cli's built-in equivalent of the Better Search Replace plugin. It's faster and safer than manual SQL.
When you can't access wp-admin
If your site won't load after the change (because the URL settings don't match where you actually visit it from), update via:
Option 1: wp-config.php override
Add to wp-config.php:
define('WP_HOME', 'https://newdomain.com');
define('WP_SITEURL', 'https://newdomain.com');
These hard-code the URL settings, overriding what's in the database. WordPress loads correctly at the new URL.
Option 2: Database update via phpMyAdmin
- Open phpMyAdmin from your hosting.
- Navigate to your WordPress database →
wp_optionstable. - Find rows where
option_nameishomeandsiteurl. Editoption_valueto your new domain. - Save.
WordPress's URL settings now match the actual URL.
DNS cutover
Don't forget DNS:
- Point
newdomain.comat your hosting's IP (or use our nameservers). See Pointing your domain to your hosting. - Wait for DNS propagation.
- Test the site loads at the new domain.
If you're keeping the old domain working too, set up a 301 redirect from olddomain.com → newdomain.com. See Redirecting URLs.
Common issues after domain change
Mixed content warnings
Browser shows "not secure" or "mixed content" because some asset URLs are still pointing at the old domain. Run a more thorough search-replace; check wp-content/themes/your-theme/ for hardcoded URLs.
Broken images
Image URLs in posts are still pointing at the old domain. Search-replace should fix; if not, check the database wp_posts table directly.
Cached pages still show old URL
Flush all caches:
wp-admin → LiteSpeed Cache → Toolbox → Empty Entire Cache.- Cloudflare → Caching → Purge Everything.
- Browser hard-refresh.
Theme/plugin custom settings broken
Some themes and plugins store URLs in their own settings structures (often serialized). If they use absolute URLs and don't get caught by search-replace:
- Look in
wp_optionsfor plugin-specific rows referencing the old URL. - Update them via phpMyAdmin or the plugin's own settings page.
Power-user note
For sites with serialized data in custom database tables (not just wp_options or wp_postmeta), the safer search-replace tool is WP Migrate Lite or its paid version WP Migrate. They handle a wider range of serialized data types than Better Search Replace.
For migrations between development/staging/production environments, set up a wp-cli workflow:
wp search-replace 'staging.yourdomain.com' 'yourdomain.com' --all-tables --dry-run
The --all-tables flag covers custom plugin tables. --dry-run previews without committing.