What this problem looks like
WordPress stores the site address in wp_options and embeds URLs inside post content, meta, and widget data. A domain change needs both settings updated and a careful database replace.
Never use plain SQL REPLACE on the whole database when plugins store serialized PHP arrays. Length changes corrupt serialized data.
Step 1: Change URL in wp-admin
- Settings → General.
- Update WordPress Address and Site Address to the new URL.
- Save. You may need to log in again at the new URL.
Step 2: Lock URLs in wp-config.php
Open wp-config.php in your site root, next to wp-admin and wp-content. Search for WP_HOME and WP_SITEURL first. If those lines already exist, update them instead of adding duplicates. If neither exists, paste the constants above the line that says stop editing:
define( 'WP_HOME', 'https://newdomain.com' );
define( 'WP_SITEURL', 'https://newdomain.com' ); Step 3: Search-replace with WP-CLI on SSH
Only run these commands if you have SSH access to the server.
wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables --precise
wp search-replace 'https://olddomain.com' 'https://newdomain.com' --network --url=olddomain.com Step 4: Update .htaccess and redirects
Find .htaccess in your site root, next to wp-admin and wp-content. Add 301 redirects from the old domain on the old host so SEO and bookmarks survive.
Update Google Search Console and analytics properties after cutover.
Step 5: Common problems after URL change
- Login redirect loop: cookie domain or http/https mismatch.
- Mixed content: hardcoded http assets in posts.
- Broken media: uploads URL still pointing at old CDN.
When to stop DIY and hire help
Domain moves on WooCommerce and multisite need serialized-safe replaces and checkout testing. BugShield handles WordPress URL changes at a confirmed fixed price.