How To Migrate A WordPress Site From Localhost To Server Using Plugins
Building a site locally is a good idea, but just hearing the word ‘migration’ can strike fear into even the noblest of hearts. Luckily, migrating from local to live is easier than you might think…Oct 2020: We tested all the best WordPress hosts! Find out how we compare.
I don’t need to spend half an hour rambling on about why you should use a local environment to build your site…because I already did that here.
But just in case you’re too fatigued to click on the above link and go a-a-a-l-l-l the way to another post, let me give you the cheat notes…
Continue reading, or jump ahead using these links:
- WordPress Localhost Environment
- Localhost, Not Local(g)host
- How to Take the Localhost Site Live?
- Migrate with Shipper
- Migrate Using Duplicator
WordPress Localhost Environment
A localhost or local WordPress setup is where you have WordPress and all of its required components like a database, PHP, and Apache server installed on your own computer or laptop instead of a webhosting server.
There are pros and cons to using a WordPress localhost environment.
When you set up WordPress online, you can share your posts and content with other online users immediately after creating these. Just click Publish and the whole world can access and view your content simply by entering a URL into their web browsers.
This isn’t quite as simple with a local version of WordPress because everything is hosted on your computer, rather than online.
One of the pros of using a localhost WordPress environment, then, is that you can create content, install, and test plugins and themes, mess with code and templates and customize files on your site without anyone else being privy to what you’re doing, as it all takes place in your own computer.
In addition to being able to mess with things without anyone taking a peek at what you’re doing, there are other benefits and advantages to using a localhost environment.
Like cost, for example. You don’t need to buy a domain or pay for webhosting until you are ready to take your site(s) live.
Note that I said site(s) above. That’s because with localhost, you can build as many sites as your computer can handle…and you can work from anywhere around the world because no internet connection is required (yes, smartypants…even underwater if your computer is waterproof).
By keeping a clone version of your real site on a localhost setup, you can also test different settings and customizations, make updates to your WordPress core installation, plugins, and themes, and spot any conflicts or issues that could affect your users before transferring these changes across to your live site.
Localhost, Not Local(g)host
I’m here to tell you that if you’ve never migrated a localhost site to a live one, it’s not as scary as it might seem.
Building a local or offline version of a WordPress working environment on your laptop or PC may sound like it’s hard and complicated, but it’s really not.
All you need is a way to install applications like Apache (server), MySQL (database), and PHP (program language) –note the acronym AMP, and there are several software packages (called stacks) that will let you do this.
If you fancy giving it a try but you’re not quite sure how to get set up with localhost, check out this XAMPP tutorial.
How to Take the Localhost Site Live?
There aren’t many WordPress-related dilemmas that can’t be solved with a good plugin, so you shouldn’t be surprised to learn that there are a few solid ways to migrate your site without needing to set foot anywhere near a database.
In this article, we’ll take a look at two easy-to-use methods to migrate WordPress from localhost to server and go live – Duplicator/SFTP, and our very own Shipper plugin.
As Shipper is a Pro plugin, it’s only available to members, so if you’re not quite ready to take the leap, you can skip straight to the Duplicator tutorial further down the article (we won’t hold it against you.)
Migrate with Shipper
First things first, you need to have Shipper installed on both your local site and live one.
You can then open Shipper on your local site and select ‘Export’.
The next screen will show a list of the sites connected to your Hub – you’ll need to select your destination for the migration.
You are then given the option to exclude any files you don’t want to be included.
You can use the advanced tab to exclude seldom-used WordPress files that you probably won’t need such as:
- Spam comments
- Post revisions
- Inactive themes
- Inactive plugins
When you’ve decided what you’re taking with you, it’s time for the Pre-flight Check.
This will detect any issues that might crop up during migration and will display recommended solutions.
Once you make it safely past the check, you’ll need to choose a prefix for your database name.
By default, the WordPress database table prefix is wp_
When migrating tables with Shipper, you can migrate tables with:
- Source’s prefix
- Existing destination prefix
- Custom prefix
With setup complete, you’re now ready to begin the migration.
You’ll get a rough estimate of how long your site should take to migrate based on the size of your files, and you can keep track of the progress with the bar as shown below:
In the interest of complete transparency, I won’t sit here and claim that Shipper is completely immune to encountering migration headaches (you’ll be hard-pressed to find any plugin that is!).
For example, there’s no knowing when you might come across an incompatible file, or rogue bit of code – causing your migration to hit the wall.
The good news is, when you’re a WPMU DEV member, this should never be a reason to panic, as our expert team of WordPress superheroes are well-versed in rescuing people from migration misery.
Another thing you may want to consider doing as a courtesy to your visitors is to use a free maintenance plugin while you’re doing work on your site.
Migrate Using Duplicator
So, Duplicator it is!
First things first – head to the WordPress plugin repo and download it.
Step One: Package and Download Your Files
Duplicator allows you to download two files – an archive of your content and configurations as well as an installer.php script.
These files hold everything you’ll need to transfer your site from one server to another.
Open Duplicator and click Create New to start the process.
You’ll then need to name your file package ready for it to be compiled and downloaded.
The Archive tab above allows you to exclude certain files from the transfer, just like with Shipper.
The Installer tab allows you to input the database installer fields – if you don’t know them, that’s absolutely fine as they’re optional at this stage.
You can now click Next, which will allow Duplicator to undertake a quick scan to make sure everything is in order before your files are compiled.
Next, click the Build button,
Once your files are ready, you’ll be able to download them with the links below.
You’ll need to download both the archive folder which will include all your files, plus your installer file.
Step 2: Copy Installer and Archive Files to Live Site
Now that you have everything you need from your old site, it’s time to transfer all the goodness to your new one.
You’ll be doing this with an SFTP client such as FileZilla.
Firstly, you’ll need to connect your SFTP client to your live site using your credentials. If you’re using our hosting (which, let’s be honest, you should be), here’s a simple guide to creating credentials and getting your connection set up.
Once your connection is established, you need to navigate to your public_html folder and paste all the files you downloaded (you may need to extract them from zips first).
You can keep an eye on the progress of the upload in the bottom left corner.
Once your files are copied over, you’ll need to run the installer script.
You do this by heading to “your-url”/installer.php.
Just four simple(ish) steps now stand between you and a successful migration.
The first is easy; wait for the validation checks to be completed and hope they pass with flying colors.
If the checks do hit a hurdle, details of the issue(s) will be displayed.
You can then decide whether it’s something that requires fixing, or if it’s something that won’t interfere too much with the migration.
When you arrive at the next screen, you will have to enter four sets of details.
These details will allow the installer to connect to your live database and remove all the previous data.
You can get the details by heading to the hosting section of The Hub and clicking on Tools. Click on Reset, then confirm.
You can then head back into FileZilla and download a fresh copy of your wp.config file, which will display the host, database name, username, and password.
You will then need to enter them during this step of the installer.
Step three allows you to rename your site if you need to.
You’re almost there―just one last step!
All you need to do is click on the Admin Login button and log into WordPress.
Once you have successfully logged in, you will be back at the good ol’ WordPress dashboard.
Before you dive in, make sure you check the message from Duplicator:
Time for a Migration Celebration or Commiseration?
All going well, your locally-built site has now been deployed onto your live server!
However, sometimes no matter which plugin you use, or how diligent you are, you’ll run into an issue or two.
This is exactly why a support team of WordPress Superheroes are so darn valuable.
When a problem hits, you don’t just need a second pair of eyes, you need reliable help, from a seasoned WordPress migrator, STAT!
We know that when you’re in the midst of a migration meltdown, the last thing you want to do is log a ticket and twiddle your thumbs for 24 hours.
Our live support team members know a thing or two about migrations and no matter who you’re hosting with or which method(s) you’ve tried, they’ll get you back on track.
On that final note, if you’re reading this article because you’ve already had a migration malfunction, our Support Team is ready and waiting to help you finish what you started.
We’d even be as bold as to say give us a try if you get stuck in a migration rut and need a hand to pull you out.
We’re confident you’ll wonder how you ever coped without our awesome support team.