wordpress-migrator-mamp

I currently have 3 WordPress sites which I host on AWS Lightsail. I use the free version of the UpdraftPlus plugin to ensure they are all backed up on a regular basis (with backups automatically being pushed remotely to DropBox). So far so good. However, I’ve recently thought I need to (a) verify the backups work, (b) keep local copies of backups alongside the DropBox backups (as they get rotated on a regular basis – and I’d like to keep some more long lived backups for those ‘just-in-case’ scenarios, and (c) – be able to run multiple wordpress sites locally so I can tweak the sites in a local development environment.

Up until now I’ve just been making changes directly on the prod versions (I know, I know.. *hangs head in shame*), but it doesn’t worry me too much in this case as they are just knockabout sites for my own amusement, and if one went down it would hardly be the end of the world. However, one of them in particular (secretmacau.com) is starting to grow in visitor numbers (to the point when I can consistently see people online in the Google Analytics real time view – which is a first) – so I decided I should really be more disciplined with my updates. Also – the site itself needs a major UI overhaul, and that’s something that obviously needs to be done in a development environment. Ideally I’d like to migrate the entire site, including data, to my local machine to get a proper development environment.

So I decided it was time to take steps. I installed MAMP on my Macbook to get a simple to set up PHP/Wordpress stack (I’ve used it before and had a positive experience – it does what it says on the tin, is easy to set up and unobtrusive). I then thought I could just create 3 new WordPress installations in the Apache server (just by creating subdirectories in the htdocs folder) and restore each from backups. As it turned out – it wasn’t quite that simple (but it also wasn’t difficult) – this post just outlines what I did in case it’s useful for someone else going through the same process.

The first obstacle was that the out of the box backup/restore from UpdraftPlus don’t take into account the domain name change to localhost. A quick read of their website highlighted that the Premium edition is what I would need for this. That is of course fine – they have an excellent product and I don’t mind paying for extra functionality to support them. The Premium edition was going to be quite expensive to use on all 3 sites for what I needed, and came with a bunch of add-ons I didn’t really want now (maybe in the future I may need them, but not right now). A bit more digging and it turned out you can buy each add-on individually – and as all I needed was the Migrator – that came out at just over 20GBP for unlimited sites – great, I’ll use that (I could have looked more at other plugins to handle the migration, but really wanted to exercise it using the same files I was using for backups – just to verify the restore process).

After removing the free version and then installing the Premium plugin (upload the plugin zip file from the UpdraftPlus website) – I just needed to log in and activate the Migrator add on (all straightforward – just enter your UpdraftPlus login details and follow the instructions). I then created a new backup on each of the sites (note: old backups created before I added the migrator add-on didn’t seem to work – I had to first create a new backup).

Great – so I now have new backups created after installing the migrator on my prod sites.

I then created the 3 subdirectories in my local MAMP Apache htdocs folder (to house each of my WordPress sites) – and installed a vanilla version of WordPress in the root of each (after first creating a new MySQL database using the MAMP tools). I verified I could log into the new WordPress installation, and added the UpdraftPlus premium plugin (essentially following the same steps as setting it up on the Production server version).

Great again – so I now had vanilla WordPress installations locally, with the Migrator plugin installed, ready to be restored from the server backup.

http://localhost:8888/adrianmilne

http://localhost:8888/secretmacau

http://localhost:8888/alkainos

In the UpdraftPlus dashboard – it was just a question of clicking ‘Restore’ and uploading the backup files created above (after downloading them from DropBox). The Migrator tool is intelligent enough to realise you are restoring to a different domain and asks if you want it to update everything for you. I clicked yes – and it quickly completed.

Hey presto – when I then pointed the browser at http://localhost:8888/adrianmilne – there was an exact replica of my live site.

But… and this is the second hurdle. Clicking on any link from the home page threw an error – as it was looking for index.php at http://localhost:8888/wordpress/index.php (i.e. not picking up my site subdirectory name – just defaulting to ‘wordpress’)

A simple workaround for this was just to edit the .htdocs file in the root of each local directory folder. This is an example of the file before I changed it – it was just a question of changing the highlighted ‘wordpress’ to be the name of the htdocs subdirectory I was in.

htaccess file

 

Once I did that – everything worked!

So now I have 3 working local backups, fully populated with data from my production WordPress sites. Now, at any time I want I can restore them from production backups.

All that’s missing is having the time to actually do anything productive with them…

(Visited 931 times, 1 visits today)
Migrate and Run Multiple WordPress Sites Locally Using UpdraftPlus Migrator and MAMP
Tagged on:                     
InstagramPlease check your feed, the data was entered incorrectly.