How to transfer a Wordpress site from one domain to another?


Other than uploading your wordpress sites to the new domain, you will need to do some changes in your database. Therefore, when you want to move the wordpress website to a new domain, you will find out that existing database records are still pointing at the old domain. So how do we properly migrate our wordpress site to the new domain name?

I have seen a lot of developers going straight to the database and updating records to a new domain. Some just write update queries to change the domain. Usually they end up with corrupt wordpress site - which may not be functioning. If you are lucky the site may be still working but you may experience other issues with the website later on.

So what makes changing the wordpress domain so complex? And is it really such a big deal? Not really - the answer lies in serialised strings in the database. Because you cannot manually modify serialized strings, you will need a script to do this for you.

After searching I found out some useful script that will help you replace all occurrences of the old domain to the new one.

Action Points

Follow these steps for proper migration of your wordpress site:

  1. Before starting I prefer to backup the existing database. You can do this from the control panel, or phpmyadmin / other database access interfaces - if something goes wrong you can always restore your wordpress site database.
  2. Download the script from this link:
    [download-attachment id="323” title="”]
  3. Extract the contents to where you have uploaded your website.
  4. Access the url which will lead you to installed script location
  5. Carefully choose the old site name in the strings to replace, including http:// and www in case it was used in the old wordpress configuration. For example: http://www.[oldsitename].com
  6. Submit the new site name with the full url : http://www.[newsitename].com
  7. Submit the database credentials
  8. Dry run the script to check what changes will be made after the script is running
    (You can click on specific change to see the differences which will be made in the database script)
  9. Click “Update” and confirm to update the database record
  10. Enjoy your properly migrated wordpress site.