Update April 27, 2017
How times have changed in the WordPress world. Instead of using the old-school way mentioned below, WordPress now has multiple plugin options to migrate your site. The one I use is All-in-one migration tool. Works great, is quick and you can easily move your site from localhost, webhost, change of domain name etc… Contact me if you have any questions on WordPress migration?
How to migrate your WordPress website
I have performed many migrations of wordpress. When I build sites for clients I typically create the site on my server at home and provide the client with a url so he / she can see the progress of the site. This process can also be used for migrations from one domain to another.
Once the client has given the A-ok to move the site from production to live i.e. from localhost to www.mydomain.com, this is where the migration begins.
- First I will use phpmyadmin and export the database and save the sql file the clients folder. This SQL file will also be used as a backup in case something happens with the migration.
- Most clients host with me but if your client has already bought a hosting package get the FTP details and then upload all wordpress files to the clients server. Once the files have been uploaded you will have to change the wp-config.php file on your clients server. You will have to change the:’DB_NAME’ – Name of your clients database you have set-up
‘DB_USER’ – username for the database
‘DB_PASSWORD’ – Password for the database
‘DB_HOST’, ‘localhost – in most cases your DB Host is localhost
- Once the config file setting has been changed to your clients server settings you will need to download and add a search and replace script to change the domain path from your testing server to your clients domain. Download file here
- Once you have the file downloaded you must place the php file in the root directory (where your wp-config.php file is located)
- Go to http://yourdomain.com/searchreplacedb2.php.
- You should now see the homepage of the script. Make sure to have “Pre-populate the DB values form with the ones used in wp-config? It is possible to edit them later.” checked and press “Submit”.
- At the Database details page, you should see your database credentials pre-populated from your wp-config.php file. If not, fill in your database credentials now. Click “Submit DB details”.
- Now you can choose table to search and replace through. I normally do all tables for single WordPress installs. Read the warning about the GUID columns in the posts table. If that is something you want to leave out, you have that option.
- I recommend starting the search and replace string with an http://. For example, use http://yourdomain.com and not yourdomain.com. This will leave out email addresses in your database from being replaced. Don’t forget to put http:// in the replace box too!
- The script will now give you some stats on the changes it accomplished. Check your data and see if everything is working correctly and visit your site. Test Test Test is the key at this point!
- Remember to remove the script from your server. This is a security measure so that no one can change your database through the script.
- Finally, login to the domain where you migrated the site and in the Admin section click the settings tab on the left and you should be in the General Settings section. Make sure WordPress Address (URL) and Site Address (URL) is the domain you have migrated to.
- Now the last thing to do is test your site! Check your widgets, menu’s, images etc. and make sure everything displays and clicks to the proper webpages.
If you are uncomfortable migrating your wordpress site I charge a nominal fee to do WordPress migration. You can contact me here for a quote.