X

How to Transfer WordPress from Local Server to a Live Site (Step by Step)

move wordpress from local server to live site

Do you want to move your WordPress site from a local server to a live site? Deploying your WordPress site on a local server is one of the best ways to speed up the development process. It helps you ensure that your WordPress site works perfectly, even before bringing in traffic.

The easiest way to transfer your WordPress site from a local server to a live site is by using a WordPress plugin like BackupBuddy or Duplicator.

If you’d rather move your WordPress site without using any plugins from a local server to a live site, just follow the step-by-step guide below.

But if you still want to do it the easier way, don’t worry. We’ll show you how to transfer WordPress from a local server to a live site using the Duplicator plugin at the end of this article as well.

Moving WordPress from a Local Server to a Live Site- Prerequisites

Before you begin, we’re assuming that you have a WordPress site running on your local server and you have full access to it.

You’ll also need to purchase a domain name and web hosting.

If you don’t own a domain and web hosting, then we recommend you to get it first before you begin. If you’re just starting out, the combined cost of domain and hosting can seem like quite a lot.

That’s why we’ve worked out a deal with Bluehost to offer our users a free domain name, free SSL, and over 60% off on WordPress hosting.

Click here to Claim this Exclusive Bluehost Offer »

Finally, you’ll also need to have an FTP program installed on your computer and know how to use it, so you can upload your content and files to the live site.

Once you’re ready, you can go ahead with migration.

Table of Contents – Migrating WordPress From a Local Server to a Live Site

I. Transferring a Site Without a Plugin

  1. Export Your Database From a Local Server
  2. Import WordPress Files to a Live Site
  3. Create a MySQL Database on Live Site
  4. Import WordPress Database to Production Site
  5. Change the Website URL
  6. Configure WordPress in Your Web Hosting
  7. Fix Images and Broken Links

II. Transferring a Website With a Plugin (Duplicator)

  1. Install and Setup Duplicator
  2. Create a Database for Your Live Site
  3. Import Files from Your Local Server
  4. Run the Migration Script

Step 1: Export Your Database from Your Local Server

The first thing you need to do is export your local WordPress database. To do that, we’ll be using phpMyAdmin. If you’re not familiar with phpMyAdmin and need assistance with this step, then check out WordPress database management using phpMyAdmin.

In your browser, simply go to http://localhost/phpmyadmin/ and click on your WordPress database. Next, click on the Export button from the top menu bar.

export database from local server

You’ll now be asked to choose from Quick or Custom options. Choosing the Custom option provides you with a lot of different options to export your database. For a quick export, let’s choose Quick, and then hit Go. This will download your database.

export mysql database

Step 2: Upload Your WordPress Files to the Live Site

After exporting the database, the next step is to move all your site files to your live site.

In this step, you need to use your FTP client to upload your files. First, connect your FTP client to your web hosting account.

Once it’s connected, choose the correct directory in your hosting account where you want to upload the files. For example, if you plan to host the site on example.com, then you’d want to upload all files in your public_html directory.

Now, select all your local WordPress files and upload them to your live server.

upload wordpress files

Step 3: Create a MySQL Database on Your Live Site

While your FTP client is uploading your WordPress files, you can start importing your database to the live server. Most WordPress hosting providers offer a cPanel to manage your hosting account. In this step, we’ll show you how to create a database by logging into your cPanel.

After you’ve logged into your cPanel, click the MySQL Databases icon which is usually found in the Databases section.

mysql databases

On the next screen that appears, specify the name for your database in the New Database field and then click Create Database.

create a new database

Now that a new database was created, scroll down to the MySQL Users section and create or add an existing user to the database.

create mysql database user

After adding the user, you’ll be prompted to set MySQL privileges for that user. Simply grant all privileges to the user, and then hit the Make Changes button.

all privileges

Step 4: Import WordPress Database on Your Live Site

Next, you’ll have to import your WordPress database to your production site. In your cPanel, scroll down to the Databases section and click on phpMyAdmin. This will direct you to the phpMyAdmin section. Make sure to select the database you created in the previous step, which has no tables created.

Click the Import tab from within the top menu. Select the file you want to import by clicking Choose File. Make sure to choose the correct file that you’ve downloaded in the first step from your local server.

After selecting the file, click the Go button to import your WordPress database.

import database

Step 5: Change the Site URL

The next thing you need to do is change the site URL in your database so that it connects with your live WordPress site.

In phpMyAdmin, look for the wp_options table in your database that you’ve just imported in the last step. In case you changed your database prefix, then look for {prefix}_options instead of wp_options.

Select the Browse button that you can find next to wp_options. Alternatively, you can browse the wp_options table by clicking on it in the sidebar as shown in the screenshot below.

browse wp_options

In the option_name column, look for siteurl. To edit the site URL, click the Edit icon as shown in the screenshot.

edit siteurl

Clicking on the Edit icon will open an edit field window. Make sure to replace the URL shown in the option_value box with your domain name.

Hit the Go button to save the field.

change-site-url

Next, you’ll need to replicate this step for the option name: home. The wp_options page can be a few pages long, so simply find the home tab. Usually, it is on the second page, which you can navigate to by clicking on the pagination arrows in phpMyAdmin.

When you’re updating the home url, make sure that it’s same as your siteurl.

Step 6: Configure WordPress in Your Web Hosting

Next, it’s time to configure WordPress in the production environment.

If you try to access your site now, you may find a message like this: Error Establishing Database Connection. By configuring WordPress, our goal is to fix this error and set up the live site.

Go back to your FTP client and connect it to your website and then edit your wp-config.php file. In this step, you’ll have to add the same database name, user, and password to your wp-config.php as you created in Step 3. Then, save the wp-config.php file and upload it back to your web host.

Visit your website, and it should be live now.

Next, you need to login to your WordPress dashboard and navigate to Settings » General. Without making any modifications, scroll to the bottom and click the Save Changes button. This will ensure that the site URL is corrected anywhere else that it needs to be.

Next, head over to Settings » Permalink and click Save Changes to ensure that all your post links are working fine.

Also check: How to Setup Pretty Permalinks in WordPress.

Step 7: Fix Images and Broken Links by Updating Paths

One of the common issues you might find while migrating your WordPress site from one domain to another, or from a local server to a live site, is that you’ll discover broken links and missing images throughout the site after migration. To fix this, you can either use an SQL query or the Velvet Blues WordPress plugin.

For those who want to do it via SQL, here is a simple SQL query that should solve this problem:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');

Simply go to phpMyAdmin, click on your database, and then click on SQL from the top menu. Write this query, but make sure to modify the URL of your local site and live site.

run sql

That’s it! Your live site should be up and running now.

Transferring WordPress from Local Server to Live Site with a Plugin

If you want to move WordPress from a local server to a live site easily, this is the best method for beginners. With a migration plugin, you can transfer WordPress from your local server to a live site with just a few clicks.

Let’s begin.

Step 1: Install and Setup the Duplicator Plugin

First, you need to choose a migration plugin, we recommend choosing Duplicator.

Next, install and activate the plugin on your local site. If you’re not sure how to install and activate a WordPress plugin, check out our detailed guide on how to install a WordPress plugin.

After the Duplicator plugin is installed and activated, click on Duplicator in your WordPress dashboard, click on Packages, and then click on the Create New button.

duplicator-create-new-package

On the next screen, simply click the Next button.

create-new-package-next

Duplicator will then scan everything to make sure it’s all in good order. If all of the items in the system scan come back marked as ‘Good’, then click on the Build button.

duplicator-scan-complete

This process of “building” may take a few minutes. Because what the plugin is doing is making a complete copy of your WordPress site. This includes all the core WordPress files as well as your themes, plugins, images, uploads, and a backup of your WordPress database. So, the time it takes depends on the size of your website. Make sure to leave this tab open until the process is complete.

Once the process is complete, you can click on the One-Click Download button to download both the Installer and Archive package files to your computer.

download-package

Step 2: Create a Database for your Live Site

Now that you’ve downloaded the Archive file of your site and the Installer file, which will automate the migration by unpacking the archive file, you need to create a MySQL database for your live website.

To create a database, go to your hosting account’s cPanel dashboard. Once there, scroll down to the Databases section and click on the MySQL Databases icon.

my-sql-databases

Next, you’ll see a field called ‘Create New Database’. Simply type in a name for your database and click on the Create Database button.

create-new-database

Once you click that button, cPanel will create a new database for you.

The next step is to scroll down the page to the ‘MySQL Users’ section. Add a new user by creating a username and password. Then, click on the Create a User button. Be sure to generate a secure password and remember your username and password because you’ll need them again later.

add-new-user

After creating the new user, you’ll need to give that new user permission to work on the database. To do that, scroll down to the ‘Add a User to Database’ section. Select the new user you just created from the dropdown menu in the ‘User’ field. Then, select the database you created from the dropdown in the ‘Database’ field. Finally, click the Add button.

add-user-to-database

Now your database is ready to be used with your WordPress site.

Step 3: Upload Files from Local Server to Live Site

The next step is to upload the archive and installer files from your local site to your hosting account.

You can connect to your live site using an FTP client. After you’ve connected to your live site, it’s important to make sure the root directory of your website is empty. The root directory is typically the /home/public_html/ folder.

For instance, if WordPress is automatically installed there like many website hosting companies do when you sign up, you need to delete those files.

When the root directory is completely empty, you can upload the archive and installer files from Duplicator.

upload-files-root-directory

Step 4: Run the Migration Script

Next, visit the following URL in your browser: http://mywebsite.com/installer.php

Don’t forget to replace “my website” with the actual domain name.

Entering this URL in your browser will launch the Duplicator migration wizard.

duplicator-migration-wizard

A validation test will be performed, once you get the green pass, accept the terms & conditions by checking the box and hit the Next button.

On the next screen you’ll enter your WordPress database information which includes the username and password you created earlier.

Hint: It will also ask you for your host which is likely “localhost”.

duplicator-install-database

Click Next to continue.

The Duplicator plugin will now import your WordPress database from the archive to your new database.

Next, the update data screen appears. The plugin automatically detects the URL of your new site and it’s path though, so you don’t actually have to update anything here. Just click Next to continue.

update-duplicator

After the migration process is complete, you’ll see a success screen like the one below. From here you can go to the WordPress admin area of your live site by clicking the Admin Login button.

duplicator-admin-login

That’s it, your work is done. Once you login to your live site, Duplicator will clean up the installation files for you.

We hope this guide helped you successfully move your WordPress site from a local server to a live site. Now, go back to your live site and figure out if everything is working as expected.

Alternatively, you can use BackupBuddy instead to migrate WordPress from a local server to a live site.

If you enjoyed this article, you might also want to check out the best backup plugins for WordPress.

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!
[60% OFF Today!]
[60% OFF Today!]
[10% OFF Today!]
[10% OFF Today!]
[50% OFF Today!]
[50% OFF Today!]