How to change the WordPress Base Url or Site Url or Home Page Url on Migration
In WordPress, Domain name change is a big issue you need to fix. Here we are providing a simple solution to fix the issue.
Open wp-config.php file in your website root.
Add the folloing line after <?php tag.
define( 'WP_HOME', 'http://example.com' ); define( 'WP_SITEURL', 'http://example.com' ); define( 'RELOCATE', true );
Save your wp-config.php file.
Open wp-login.php in a web browser. For example, if your new site is at http://example.com.com/wp-login.php
Now go in Admin back-end, navigate to Settings > General and update Site Url and save.
Now delete or comment lines added in wp-config.php file.
Your site has been migrated and updated for the new domain.