While moving a WordPress site from one host to another, testing through a development domain, I quickly realized there are a lot of places where the URL was still from the old site. There are plenty of tools to backup your site, your database, and your posts. I wanted one to change the paths. Something super easy and quick. WordPress offers overrides for testing, but doesn’t apply throughout. I found WP Migrate DB. This works both for a live host and if you are developing using XAMPP or some other local situation. Essentially WP Migrate DB does a find/replace on your database and then exports as a SQL file.
So…let’s start at the very beginning (a very good place to start).
Install The Plugin
First you will need to download and install the plugin WP Migrate DB. It’s easy to find a backup tool but not for migration. You can do the plugin search directly from your backend to quickly install the plugin or use the plugin’s manual install instructions.
Install the plugin from the screen.
You can also install manually by following the steps below:
- Download wp-migrate-db.zip
- Unzip the archive
- Upload the wp-migrate-db folder to your wp-content/plugins directory
- Activate the plugin through the WordPress admin interface
- Access the WP Migrate DB menu option in Settings
Activate The Plugin
Activate the plugin :
Export Your Database
Go down to Tools > WP Migrate DB
From here you will see 4 fields. The current and new address and current and new file path. The first one is self explanatory. The second is the path from your server. If you aren’t sure what it is, then you can make a PHP info file. You create a PHP file with <?php phpinfo(); ?> in the source, save, and then load it up on your hosting directory and access it (site.com/phpinfo.php). Scroll down to SCRIPT_FILENAME and it will show you the path of your server.
Once you’ve put in the information for the new site, click “export database”. It will save a SQL file for you.
Import The Database
On the NEW site, go to your phpMyAdmin, access the database you have WordPress in (or will have it in since you will be importing), go to “Import” and then choose the SQL file you downloaded.
Remember this is for just the database. Make sure your permalinks rewrites through .htaccess are reset (you might need to wipe the .htaccess file, turn permalinks to default, and then back to your preferred setting) if your root is changing and f you have any CSS that calls to a full path on your old host – that will need to be manually updated.
Disclosure: This page may contain affiliate links for which we will receive compensation if a purchase is made via the link.