There are a lot of reasons why building your WordPress website locally is a smart idea — for example, you can avoid paying for hosting while you’re still in the development phase. However, once your website is ready, you face another challenge, which is moving it to a live server.
Fortunately, migrating a WordPress website from a local server to a live one is easier than you’d imagine. It works similarly to the process of moving a site from one web host to another.
In this article, we’ll show you how to migrate a local WordPress site to a live server, either manually or by using a plugin.
However, before we get to the specifics, let’s talk a little about local WordPress development!
What Is Local WordPress Development
To build a WordPress website locally, you’ll need to set up a local development environment on your computer.
This is basically all of the dependencies and software required to create and view your website on your local machine. In other words, you’re turning your own computer into a local web server (not available from the internet).
As far as WordPress is concerned, here’s what you need to run this content management system (CMS):
- A web server, either Apache or NGINX
- A database management system, either MySQL or MariaDB
Although you can set up all those requirements manually, the easiest approach is to use software that bundles in these dependencies, such as WAMPServer.
WAMP (Windows, Apache, MySQL/MariaDB, PHP) — and many other tools — will help you set up entire development stacks on your local computer, including graphical user interfaces you can use to control them. This last part is key, particularly if you don’t feel comfortable using the command line.
In addition, you also have local WordPress development tools such as DesktopServer or Local by Flywheel. These provide similar functionality to bundles such as WAMP, XAMPP, or MAMP, but the interfaces are arguably more intuitive and are in constant development.
Ultimately, having a local WordPress development environment enables you to spin up new projects quickly, without having to spend more money on hosting. Moreover, you’ll always be able to access local websites from your computer, even without an internet connection.
How to Move WordPress from a Local Server to a Live Site Using a Plugin
Once you’re ready to migrate a local WordPress website to a live server, the easiest way to do it is by using a plugin. There are a lot of WordPress migration plugins to choose from, but our recommended pick is All-In-One WP Migration:
We recommend this plugin because it works with most web hosts and enables you to export all your WordPress files (including your images and media files) and database in a single file.
With All-In-One WP Migration, you can upload your local WordPress files directly into your new website, or via FTP. Here’s what you need to do to get started:
- Install the plugin on your local website.
- Install WordPress on your live server and set up the plugin there too.
Ideally, you’ll have a fresh WordPress installation on your live server. This way, you minimize the possibility that something will go wrong during the migration process.
When you’re ready, go to your local website’s dashboard, and into the All-In-One WP Migration > Export tab. Here, select the Export To > File option:
You’ll notice that the plugin offers several other export location options, but saving the file to your computer is the easiest approach.
At this stage, you can also use All-In-One WP Migration to replace any text you want on your database. For example, if you’ve been using an admin username such as ‘root’ (since you’ve been working locally), now is the time to change it.
The plugin will take care of updating your WordPress URLs, so you don’t need to worry at this stage. Once the export process begins, it might take a while depending on your website’s size:
When the process is over, you’ll be able to download a .wpress file that contains your entire local website, including its database. Remember where you’re saving the file, because we’ll need it in a minute.
Now, you’re ready to go to your live site’s dashboard. This site should be empty right now, aside from the All-In-One WP Migration plugin.
On your live site, navigate to the All-In-One WP Migration tab and select the Import option:
If you click on Import From, you’ll be able to select the .wpress file you just downloaded to your computer. One thing to keep in mind is that your web host might impose a low file size limit for uploads. Usually, the limit is pretty easy to increase, and you’ll ideally want to discuss this with your host.
If you want to import your local site using FTP, the plugin’s premium version enables you to restore backups from a folder that the plugin automatically sets up for you. You can access this folder by navigating to public_html/wp-content/ai1wm-backups within your FTP client.
Once you’re inside, you can upload your .wpress file via FTP to that directory:
After you finish uploading your .wpress file, the plugin will automatically recognize it as a backup.
Now, if you go to All-In-One WP Migration > Backups, you should see an entry that corresponds to the .wpress file you want to use.
Go ahead and click on the RESTORE option next to that entry:
Regardless of which approach you use to upload the .wpress file, once you start the import process, the plugin will warn you that this will overwrite your entire website:
Since you’re using a brand new WordPress installation, this shouldn’t be a problem. Let the plugin do its thing. When the process is done, you’ll need to log back into WordPress.
Keep in mind that since you overwrote your database with the one from your local website, you’ll need to use the same admin credentials as you did for the local installation.
After you get back into your WordPress dashboard, the plugin will prompt you to update your permalink structure right away. It should match the same structure as you used on your local website.
That’s it! At this stage, you should have a carbon copy of your local WordPress site on your live server.
How to Move Your WordPress Files and Database Manually (In 3 Steps)
In some cases, it can be easier to migrate a WordPress website manually since some plugins struggle if you have a lot of content. The manual process is somewhat more involved, but not particularly complicated.
To migrate a WordPress site manually, you’ll need three things:
- An FTP client, such as FileZilla Client
- Access to your live site’s database through your hosting control panel
- A brand new WordPress installation
Just as with the plugin approach, using a clean WordPress installation isn’t strictly necessary. However, it does increase the odds that the process will go smoothly.
Step 1: Upload Your Local WordPress Files to the Live Server
As you may know, WordPress stores all of your site’s files in what we call the root folder. Here’s what a regular WordPress website’s root folder should look like:
What you need to do now is locate your local WordPress website’s root directory. Take note of where it is, then connect to your live server via FTP.
Open your live server’s WordPress root folder, then upload all of the contents of the corresponding directory for your local site:
Your FTP client will ask you if you want to override the existing files on your live server. Say “Yes” to all requests and wait for the upload process to finish.
Depending on how large your site is, the process can take a while. In the meantime, though, you can work on the second part of migrating your local website — copying its database.
Step 2: Update the URLs Within Your Database
WordPress stores all of your site’s information in a single database. To access this database locally, you’ll need a tool such as phpMyAdmin.
Depending on which local development environment or tool you use, the way you access your database might vary. In most cases, you should be able to launch phpMyAdmin by navigating to localhost/phpmyadmin in a web browser. Of course, you may need to consult the documentation for your chosen environment.
phpMyAdmin will show you a list of all your existing databases on the left side of the screen. Before you export your database’s content, you need to update your WordPress URLs within any relevant tables.
Right now, your local WordPress website probably uses an URL such as http://localhost. This means all your internal URLs for pages, posts, and media files also use the address.
To change this, open the wp_options table within your database. Keep in mind that the wp_ prefix might change depending on how you set up your database.
Once you’re inside the wp_options table, you should see two rows at the top called siteurl and home:
Hit the Edit button to the left of siteurl and look for the option_value field inside.
You’ll see your local site’s URL there, so go ahead and replace it with the domain you set up for your live website:
Click on Go to save the changes and repeat the exact same process with the home row.
Now let’s jump to the SQL tab at the top of the screen. We’re going to run a simple SQL query that’ll replace your localhost URL with your new one throughout the rest of your site and its internal links:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/', 'www.yourdomain.com/');
Copy and paste that query within the Run SQL query/queries on table field you see below. Keep in mind that the query is using placeholders, so remember to replace them with your local site’s URL and your new domain:
Click on Go when you’re ready and that’s it. Now you can export the contents of your database by going to the Export tab at the top of the screen:
phpMyAdmin will automatically set your database’s format to SQL, so you can go ahead and click on Go. You’ll get a .sql file, which you’ll need to use during the next step.
Step 3: Import the Contents of Your Database File
Now you need to access your live website’s database using phpMyAdmin installed on your live server. Depending on which web host you use, you should have access to a control panel that includes an option to access your database.
Look for this option, and once you’re inside, go to the Import tab at the top of the screen:
Make sure that phpMyAdmin says you’re importing a file into your current server and not overwriting an existing database. To create a copy of your local website’s database on your current server, you’ll need to use the .sql file you downloaded during Step 2.
By now, your local files should have finished uploading. Among those files, there’s one called wp-config.php, which includes your database name and access information, which you won’t need to update.
Go ahead and select the .sql file you created minutes ago and click on Go. Let phpMyAdmin do its thing.
When it’s done, you should be able to access your migrated WordPress website by visiting the live domain.
Building a WordPress website locally is a smart move if you don’t already have hosting. Even if you do, being able to play with local WordPress development can enable you to try out all sorts of new features and test projects that you might not want to go live yet.
Once your local WordPress websites are ready to see the light of day, there are two ways you can migrate them to a live server:
- Use a plugin such as All-In-One WP Migration.
- Move your WordPress files and database manually.
Do you have any questions about how to move WordPress from a local server to a live site? Ask away in the comments section below!