How to Transfer WordPress Site From Localhost to Live Server (2 Methods)

When creating a website with WordPress, it is a great idea to start with localhost. Again, if you want to test certain things out, doing it on localhost is the best idea. But the question is, how to transfer WordPress site from localhost to live server?

There are a couple of ways of transferring your WordPress website from localhost to a live server. You can do it manually or use plugins. In this article, we will discuss both methods. We will learn why it is important to build your website on localhost and how to transfer WordPress site from localhost to live server.

Local development tools for Linux, Mac, and Windows

If you’re reading this article, that means that you may already have a WordPress website on your loaclhost. But still, it’s important to know which tools or software you should use to make your localhost web development easier. We recommend the following tools:

  • MAMP: MAMP is a popularly used software to build your WordPress website on localhost. It is available for Mac and Windows. It also has a Pro version. But you can use the free version to build WordPress website on localhost.
  • XAMPP: XAMPP is one of the most popular tools used for working on websites on localhost. It gives you access to phpmyadmin locally where you can create and manage your database. This is an excellent way to learn WordPress web development. XAMPP supports Linux, Mac, and Windows.
  • WAMP: Another popular program for local web development is WAMP Server. WAMP is similar to XAMP but with a different interface. With WAMP Server you can create web applications with Apache2, PHP, and MySQL database. You can also access phpmyadmin and manage your database from there.

👉 How to Install WordPress on Localhost XAMPP

Why transfer your WordPress website from localhost to live site

Although it’s really quick and easy to build a website with WordPress. If you have the right themes and plugins, it gets even easier. But it is a good practice to first build your website on localhost. Because this gives you a safe place to experiment with the design and layout of your website. After you are done building your site, your next step is to move it from localhost to a live site. Because in order for people to visit your website, it has to be on a live server.

As I said earlier, there are a couple of methods through which you can trasnfer your website from localhost to a live site. You can either use a plugin or transfer your WordPress site manually.

We will show you both of these methods, you can choose any method you want to transfer your WordPress website from localhost to a live server:

Get Latest Post Notifications!

Subscribe to our newsletter

  • Method 1: Transfer your WordPress site using a plugin
  • Method 2: Transfer your WordPress site from localhost to live site manually

Both of the methods are really easy. So don’t worry, just follow along and you won’t have any difficulty.

Before You Transfer

So you have built your WordPress website on localhost and you are ready to transfer it. But before you start to transfer your website, there are a couple of things that you have to do first. You need the following things:

  • If you have a WordPress website on localhost, you need to have full access to it
  • You need a domain name and hosting for your live website.
  • FTP/SFTP or access the File Manager of cPanel

There are various domain and hosting choices, but we recommend going with HostGator. HostGator has special packages for WordPress websites. If you haven’t already purchased a domain name, then you can purchase it from HostGator as they will give you a free domain for 1 year. Some of the benefits that you’ll get with HostGator’s WordPress plans are as follows:

  • WordPress pre-installed
  • Free SSL Certificate
  • Free domain for 1 year
  • Advanced Security
  • Free site migration
  • Advanced Security
  • Simplified Control Panel and much more,

You can still use any hosting service you want. It’s still up to you, But we recommend HostGator because of its many perks and performance.

One final thing that you need is an SFTP application to transfer files from your local host to live server. This is only required if you decide to transfer your files manually.

Now we can begin transferring your WordPress website from localhost to live site.

Method 1: How to Transfer WordPress Site From Localhost To Live Server using Duplicator plugin

For our first method, we’ll use a plugin to transfer your website. If you want to quickly transfer your WordPress website to a live site, then this method is excellent for you. But before you do anything, make sure to backup your WordPress website for safety.

Now, follow the steps given below.

Step 1: Install and Activate the Duplicator plugin

So, from your WordPress Dashboard go to Plugins > Add New and search for “Duplicator”. This plugin has been developed by Snap Creek and has 1+ million active installations.

How to transfer WordPress localhost to live server using Duplicator plugin

Once you activate this plugin, it will be added to your WordPress dashboard.

Step 2: Archive your localhost website

Now go to Duplicator > Packages and it will open the packages page. Since this is the first time you installed the plugin, you need to create a package. The package is basically the archived version of your website. So, click on the ‘Create New’ button

creating a new package using Duplicator

After clicking on Create New button, it will go through 3 steps to archive your WordPress website files.

  1. Setup: This is the first step where you have to choose a name for your compressed file. If you click on ‘Storage’ you can also select the location in your system where your file will be saved. If you purchase Duplicator Pro, you can select Dropbox, OneDrive, Google Drive, and other cloud options to save your compressed website files.
archiving website using duplicator

There are other options such as Archive and Installer, but we are not going to go through these options. Simply click on the ‘Next’ button to go to the next step.

  1. Scan: Before Duplicator archives your website files, it will scan your website. It will scan your website files, databases, systems, etc. When the scan is complete and everything is good, click on the ‘Build’ button to proceed to the next step.
Duplicator scanning website

Click on ‘Download Both Files’ to download the installer as well as the archive file.

The archive file is the file that contains all your website files such as the images, themes, plugins, and databases. It’s basically your entire WordPress website in a compressed file.

On the other hand, the Installer is a script that can automatically unpack the archive files to a live server making your life a lot easier.

  1. Build: This is the final step and once you click on ‘Build’, Duplicator will archive your WordPress website. Once the building is complete, you’ll get the option to download the installer, archive, or both the files
downloading archive file and installer.php

Click on ‘Download Both Files’ to download the installer as well as the archive file.

The archive file is the file that contains all your website files such as the images, themes, plugins, databases. It’s basically your entire WordPress website in a compressed file.

On the other hand, the Installer is a script that can automatically unpack the archive files to a live server making your life a lot easier.

Step 3: Create a new Database on live server

Before we unpack or install your localhost website to your live site, we need to create a database on the live server. We will create the new database from cPanel. So log into your cPanel and from the Databases section, select MySQL Database Wizard

MySQL Database Wizard in cPanel

This will open up the database setup wizard. First, give your database a name, and then click on the ‘Next Step’ button.

name your database

After you click the ‘Next Step’ button, the database will be created. Now you have to select a username and password for your database. Use any appropriate username you want and for the password, make sure it’s a strong one.

create database user

To create a strong password, use the combination of uppercase and lowercase characters with numbers and symbols. You can also use the Password Generator but remember to store the password in a safe location.

Finally select “All Privileges” and scroll down then click on ‘Make Changes’ button to complete your database creation.

If your hosting package doesn’t have cPanel, then ask their support to know the database creation process.

Step 4: Upload the archive file and installer

It’s now time to upload your archive and installer files on your live site. For this you need to acces your WordPress files. You can use an FTP/SFTP account if you want but we will use the File Manager available from the cPanel. So go to File Manager.

File Manager in cPanel

Now you’ll see a lot of files and folders. Some hosting companies install WordPress after your purchase. If that is the case then you have to remove these files and folders. Go to public_html folder.

public_html folder

The public_html folder consists your WordPress website files. Since we are migrating your localhost website to a new live website, I am hoping that your current live website has no important data. So you can delete these files.

Except for the cgi.bin file, you can remove the rest of the files.

deleting wp files

Now click on the upload button on top and it will take you to a new screen. From here click the ‘Select File’ and select the installer and the archive file that you got from the Duplicator plugin.

Step 5: Run the Installer script

Now your public_html directory should contain the cgi-bin file, an archive file (core WordPress files), and the installer script. To launch your installer script, you need to visit its URL. 

For example:

This will launch the Duplicator installer script. Now you just need to complete 2 steps and your migration process will begin.

running installer script in Duplicator

The first step is deployment and in the setup section select the database you just created. If you didn’t create a database, no worries, you can create one from here. From action select Create a new Database, and give your database name, username and a password.

After you are done with this step, click on validate and Duplicator will run tests and see if everything is ok.

Duplicator deployment tests

After you click on the ‘Next’ button, you’ll see a confirmation that shows you the overall details of the site migration. If everything is ok so far, you have nothing to worry about. Just click on ‘Ok’ to proceed.

Then the transfer process will begin. Duplicator will unpack the archive file containing your WordPress core files. Depending on how big your file is, it might take a few minutes. If everything goes well, you’ll see the final step, test site. Now click on the ‘Admin Login’ button and enter your WordPress username and password to login to your website.

Duplicator website deployment complete

Note: If there’s some issue with your database (for example: No table in database), then when you click on ‘Admin Login’ it will launch a WordPress setup. Just go through the setup and it will setup your database for you.

And that is how to transfer WordPress site from localhost to live server.

Method 2: How To Transfer WordPress Site From Localhost To Live Server manually

Now let’s see how you can transfer your WordPress localhost to a live site manually. Although it’s much easier using a plugin to migrate your website. But if it doesn’t work, or if you prefer transferring your site manually then this method will be helpful for you.

Just like the previous method, I would suggest that you backup your WordPress website to avoid any issues with your site.

Step 1: Export your localhost WordPress website’s database

The first thing that we are going to do is export the database of your localhost WordPress website. To do that, go to your phpmyadmin page. Simply type in the following URL:


And you’ll land on the phpmyadmin page. Now locate the database that you are currently using for your localhost WordPress site.

exporting localhost database

In the next step, you can create an export template if you want. From the export methods, you can choose ‘Custom’. It will allow you to select which database you want to export. But you can also select the ‘Quick’ method. From the Format section, select SQL.

Once you are done, simply click on the Go’ button at the bottom right to export.

It will download an SQL file on your local system.

Step 2: Upload your localhost files to live server

Now its time to upload all your localhost WordPress files to your live server. Like before you have to access your WordPress files. You can either do it by using FTP/SFTP or you can use File Manager from cPanel.

We are going to use the File Manager from cPanel to upload our files. Access your cPanel and open File Manager. Then open the public_html folder or if you are using a different directory for your website (for example: Then upload the localhost files from htdocs/yourwpwebsite to public_html or example.

Step 3: Create a database on your live site

Like step 3 of Method 1, you have to create a database on your live site. From cPanel open MySQL Database Wizard.

Then give your database a name and click on the ‘Create Database’ button. Next create a username and password for this database and click on ‘Create User’. Next, select ‘All Privileges’ checkbox and complete the database creation process.

Step 4: Import the localhost database to the live server database

The database that you exported in the first step, import that database to the new database that you just created.

importing database

From your cPanel go to phpMyAdmin and then click on the Import button. Then click on the ‘Choose File’ option and select the SQL file that you exported earlier. Make sure that SQL format is selected.

finalizing the database import

After that click on the ‘Go’ button at the bottom and your database will be imported via phpMyAdmin.

Step 5: Change the URL of your site

Although your database has been imported, you still need to change the URL since it still has the localhost URL of your site.

Go to your phpMyAdmin from cPanel and find the imported database. Then click on the ‘+’ to expand its contents, and from the wp_options click on ‘Browse’.

browse wp_option

From here, find the siteurl field and click on the ‘Edit’ on that row. Then change the URL to your domain name.

edit siteurl option

This will bring you to another page where you can change your site URL. To change your site URL find the site_value. It will have the address of your localhost website, for example, http://localhost/wordpress. Replace this address with your live website URL.

changing site url

After you are done, click on the ‘Go’ button below. You will be brought back to the wp_options page. Now click on ‘Edit’ for home option. You need to repeat the same process for the home option as well.

edit home option

The interface for home is same as siteurl. So in the option_value field, put in your live site’s URL and click on ‘Go’.

Step 6: Install WordPress on your live site

Now your WordPress files are uploaded and your database is ready, it’s now time to setup WordPress on your live site. If you try to log in to your WordPress now, you might see an error saying “Error establishing a connection to database”.

This error occurs when WordPress cannot connect with your database. In this case, we have imported our database, but we haven’t entered its credentials. To do that, we once again need to access our WordPress files. Use your FTP/SFTP to connect to your live site or you can use the File Manager.

Go to public_html or the folder where your WordPress files are stored. From here, find the file named “wp-config.php”. You can either download it or Right click on it and select ‘Edit’, to open the file in the editor.

wp-config.php file

Provide your database name, username, and password that you created in step 3. Now if you visit your WordPress website you should see the login page. Use your WordPress name and password to login to your WordPress database.

editing wp-config.php file

After entering your database credentials, click on the ‘Save Changes’ button on top and close the editor. Now you can log into your WordPress website.

Step 7: Ensure your correct site URL

Right after you login to your WordPress dashboard, go to Settings > General. Then scroll down and click on ‘Save Changes’ without doing anything. This will ensure that your site URL is corrected everywhere else.

wp general settings

Step 8: Flush site permalinks

Permalinks are the permanent links to your site’s posts and pages. Sometimes, when you migrate to a new site, the URLs of your posts and pages might not work. To resolve this, you can flush your permalinks. From your WordPress dashboard, go to Settings > Permalinks, and like before click on ‘Save Changes’ without doing anything else.

wp permalinks

Step 9: Fixing images and broken links

After visiting your site, you might not see some of the images you used on your site. You might also notice some of the links are broken. This is not abnormal and there is a fix. To fix this issue, log into your cPanel and go to phpMyAdmin. Then click on SQL and use the following SQL query

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/wordpress/', '');
SQL Query

Remember to replace the locahost/wordpress with your localhost URL and with your live site’s URL. Once you do these, click on the ‘Go’ button.

That’s about it. That is how you can transfer your WordPress localhost website to a live site manually. I hope that you managed to successfully migrate WordPress site from localhost to a live server and your website is running smoothly.

The manual process is a bit tricky and there are more chances of missing something. If you are ok with using a plugin then I suggest using the Duplicator plugin to migrate your site. It’s much easier and the plugin is free. After your transfer is complete, you can remove the plugin if you want.


Whether you are a seasoned developer or a novice, it’s always safe to build and experiment on your WordPress website on localhost. This eliminates the probability of any errors that might break your website. Also, it is a good practice to continue your web development on locahost. So you can keep a copy of your live site on your localhost. Whenever you want to make any changes, do it on localhost and then upload it to your live site. This is a much safer method.

So now you know how to transfer your WordPress localhost to a live site manually and with the help of a plugin. Which method do you prefer? Do you like using the Duplicator plugin or do you use another plugin? Let us know in the comment section.

Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Staff Author
Staff Author

A team of WordPress enthusiasts led by Arafat Bin Sultan, a seasoned professional with over a decade of experience in tech blogging, content marketing, and video creation.

Articles: 234

Leave a Reply

Your email address will not be published. Required fields are marked *