Moving a WordPress Woocommerce Site from One Domain to Another


This just happened.

A client wants to duplicate their niche e-commerce site built on wordpress / woocommerce and change the products…and domain name.  At first I was just going to do a fresh install and build out the new products.  Do an export/import of the pages and be done with it.

One small problem, they drop ship and use the table rate shipping plugin.  And the shipping tables and methods do not have a built in import/export feature.  So, just export the shipping tables and other associated data from the database right?  Nope.  The Shipping Method names are tied to the Options table which have unique id’s…a big ol’ tangled mess.

So, the options were then: build the new shipping tables from scratch…which would probably take about 3 days OR migrate the entire wordpress site and then change the content.

I had never had to do this before.  I have moved sites, but never had to change domain names as well.  Here’s what I did.

Note: this is mostly just for my own future use if I ever need to do this again.  If it’s helpful to someone else who finds it, great!  But I would not consider myself a migration expert – just someone who has successfully gotten through the process relatively unscathed.  For a good reference on the process go here: also, it would have gone more smoothly if I had found this article by David Coveney first: some of it was not applicable as my site was not a buddypress site…but the majority of it was.

  1. Create a new database for the new site.
  2. Export the old database using phpMyAdmin.
  3. Edit the sql file and replace any mention of the old database name with the new one.
  4. Import the sql file to the new database.
  5. Search and replace the domain name.  This actually turned out to be the LAST STEP.  For the search and replace of the domain name  in the database (it is more complicated than you’d think — if you read the above linked articles, they can explain it better than I), I first tried an online solution that would have done the trick BEFORE I imported the sql file to the new database, but the sql file was too large for that.  So I went for the awesome PHP script found here.
  6. Move the files. This was the most time consuming task.  I downloaded all the site files and then uploaded them to the new directory.  At first I tried just copying them from one directory to another since they were on the same server, however the server kept timing out.  It’s a shared host, so I think if it was a dedicated server it would have worked much better.
  7. I also had to change the info in the wp-config file to match the new database name.
  8. Several files still failed on the upload so I had to work through several fatal errors and make sure the files were all in place but once they were….PRESTO!
  9. Did step 5 😉 so all mentions and links of the old domain were changed over.
Tagged with:

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.