New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

Migration

How to change a WordPress URL and domain

Moving from staging to live or http to https means updating WordPress URLs in more than one place. Hardcoded links in content and serialized options break if you edit the database carelessly.

Time: 30-60 minutes Level: Intermediate

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.

Take a full backup before any search-replace. Wrong replaces are painful to undo without a snapshot.

Change URL in wp-admin

  1. Settings → General.
  2. Update WordPress Address and Site Address to the new URL.
  3. Save. You may need to log in again at the new URL.

Lock URLs in wp-config.php

Constants override the database and help when Settings screen is unreachable during migration.

php
define( 'WP_HOME', 'https://newdomain.co.uk' );
define( 'WP_SITEURL', 'https://newdomain.co.uk' );

Search-replace with WP-CLI

bash
wp search-replace 'https://olddomain.co.uk' 'https://newdomain.co.uk' --all-tables --precise
wp search-replace 'https://olddomain.co.uk' 'https://newdomain.co.uk' --network --url=olddomain.co.uk
Run dry-run first with --dry-run to preview changes before writing to the database.

Update .htaccess and redirects

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.

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 migration service handles URL changes at a confirmed UK price.

FAQs

Can I change URL without database access?

wp-config constants change the main addresses but post content links stay old until you search-replace.

Should siteurl include a subdirectory?

Yes if WordPress lives in a subfolder. Both URLs must match the real path visitors use.

Will changing URL break Elementor or builders?

Builders store JSON with URLs. Use builder tools or WP-CLI replace that handles serialized data.

How do I switch http to https only?

Update URLs to https, force server redirect, then replace remaining http links in the database.

Rather someone else fixed it?

Request a fix at a confirmed price. Named UK developer, secure Vault, direct chat.

Request a Fix