Changing WordPress URL in production can break login, media, plugin callbacks, and caching if done without a controlled process. This is the workflow I use in real migrations.
Core options
home: public site URLsiteurl: application/admin base URL
Pre-change checklist
cp wp-config.php wp-config.php.bak.$(date +%F-%H%M)
mysqldump -u DB_USER -p DB_NAME > /root/wp-url-change-$(date +%F-%H%M).sql
Preferred method: WP-CLI
wp option get siteurl
wp option get home
wp option update siteurl 'https://newdomain.com'
wp option update home 'https://newdomain.com'
wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables --dry-run
wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables
SQL method (when WP-CLI is unavailable)
SELECT option_name, option_value
FROM wp_options
WHERE option_name IN ('siteurl','home');
UPDATE wp_options SET option_value='https://newdomain.com' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='https://newdomain.com' WHERE option_name='home';
Use caution with serialized data. Prefer WP-CLI when possible.
Emergency fallback in wp-config.php
define('WP_HOME', 'https://newdomain.com');
define('WP_SITEURL', 'https://newdomain.com');
Post-change validation
- frontend;
- admin login;
- media upload;
- permalink navigation;
- cache purge;
- browser console mixed-content check.
Rollback
Restore SQL dump and wp-config.php backup, then purge cache again.
Final takeaway
A production URL change is a controlled migration task, not a single command. Structured validation and rollback make the operation predictable.
This post is licensed under CC BY-NC.
Comments
Join the discussion below.
Comments are not configured yet. Add Cusdis settings in /assets/json/config/blog-comments-config.json.