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.

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.

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.

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:

Code Snippet:


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.

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.

If you want to save time, we highly recommend you to use BackupBuddy 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!