Jack Barber / Website Design

Move Wordpress Site Between Hosts

My first attempt at a Wordpress website using the Woocommerce e-commerce plugin has just gone live.  I'll write some more about the project in a different post, and put it in my portfolio, but I wanted to make a note of the process I used to transfer the site from the dummy sub-domain we used for building and testing the site to its actual domain, which is perhaps not as straight forward as it should/could be!

Step 1 - Install Wordpress on the new hosting

This is straightforward - simply install Wordpress in the new hosting package in which ever way you favour.  I download the zip file, uncompress it, FTP the contents to the hosting and then run through the setup as usual, including editing the wp-config.php file with the new database details.  I'm not sure whether you actually have to run through the setup process in this case, as we're moving an existing installation, but it's probably worth doing.

Step 2 - Export the website's database

I use phpMyAdmin for database management, so I simply access the correct database (that of the site you wish to move) and export it in it's entirety as an SQL file.

Step 3 - Edit the exported database

The problem with the Wordpress database is that it includes lots of references to the site's domain, which will obviously need changing before the site will work at it's new domain.  To get round this problem I opened the .sql export in a code editor (I used Coda) and run a find/replace on the old domain to change it to the new domain.

In my case I changed 'baytown.jackbarber.co.uk' for 'baytownrhb.com'.  Once the change has occured simply save the .sql file.

Step 4 - Drop the fresh installation's database and upload the edited .sql

Enter phpMyAdmin (or do this in whichever way you favour) and drop all of the table from the fresh installation of Wordpress at the new host.  Then use the Import function to upload your amended .sql export of the database you're moving.  You should see all the tables reappear, populated with all the correct content.

Step 5 - Download wp-content contents and upload to new host

Using your FTP program, download all of the contents of /wp-content, ensuring you keep the file structure the same, from the site you're moving.  Then upload all of the contents to the new host's /wp-content directory overwriting any existing files.

Step 6 - Fix the permalinks problem

Once the site has been moved, you'll probably find that pages don't appear (you'll get a 404 error or similar).  To fix this, enter the Wordpress admin system and find your way to Settings > Permalinks.  Set both 'Common Settings' and 'Product permalink base' options to 'Default' then click 'Save Changes', then reinstate the setting you would prefer. 


Hopefully now your site will be active and work properly at your new host.  If you've got any tips for improving this process, or questions, use the comments below.