Seriously, how to upload wordpress website from localhost to server? While we often use a local server to customize websites or use coding for development purposes, many of us don’t know the appropriate method. A local server is used on a regular basis to work privately on websites. But do you know?
-Your site won’t be visible to the users when it remains on the local server
Yes, that’s right. So, you can’t always keep your website on the local server. You have to move your site to the live server eventually. This will allow online visitors to use or visit your website. Therefore, you need to upload WordPress website from localhost to server once you think your site is ready to show the world.
Keeping that in mind, we decided to show you how to upload WordPress website from localhost to server in this article. Let’s start!
Why Is It Important to Move WordPress Website from Localhost to Live Server
Changing or moderating your website on a local server is a common method. When some parts of your website are still under development and you don’t want to show it to the visitors, you can keep your site on the local server.
Once you have finished the modification and are determined to show it online, then you must transfer it to the live server.
Manually Upload WordPress Website from Localhost to Server in 7 Steps
We are going to demonstrate the manual process of uploading a WordPress website from localhost to a live server in just 7 steps. We expect your full attention on this.
Our method is preferable for those who like to do things manually. If you want to upload WordPress website from localhost to server manually, then this method is for you. Let’s begin.
Step 1: Export the Database of the Local WordPress
The first thing to do in manually transporting your WordPress site from localhost to the live server is to export the local WordPress database using the phpMyAdmin. Before that, make sure you know how to access the local server. You can also ask your hosting provider for assistance.
Once you are inside the local server, go to –
http://localhost/phpmyadmin/
Select the WordPress database and then, click the ‘Export’ button from the top menu bar.

There are 2 options to export the database – ‘Quick’ and ‘Custom’. Although the ‘Custom’ option will give you more options for exporting the database, we suggest using the ‘Quick’ option as it is more convenient and time-consuming.
After selecting the export option, just click the ‘Go’ button to download your database.

Step 2: Upload WordPress Files to Live Server
Once you are done with the database export, you need to move WordPress files from the local server to the live server. You can either use an FTP server or cPanel for this. And if you don’t have access to these, you should immediately contact your hosting provider.
When you connect to either the FTP server or cPanel, head towards the subfolder location and download all the necessary WordPress files to your computer.

After that, locate the public_html folder and open it, which can be found inside the root domain.
Please Note:
The public_html folder can be named as ‘www’ or after your domain name. It depends on the hosting environment.
In this folder, upload all the files that you have downloaded earlier from the root directory.

Step 3: Create MySQL Database on The Main Server
You can either create a new MySQL database for your WordPress site or import one to the live server. Your hosting provider should be giving you cPanel access. You can create a MySQL database easily by using the cPanel.
On the other hand, you can start importing the database from the local server to the main server while your FTP client is still uploading WordPress files.
In order to create a database in the live server, log in to the cPanel. Under the cPanel dashboard, go to the ‘Database’ section and select the “MySQL Database Wizard” icon.

This will bring the next screen where you need to provide a name for the database. Once you give a name to your database, click the “Create Database” button. This will automatically generate a new MySQL database for you.

Creating a new database will require a new user. So, you have to provide a username and password in the next tab. After that, click on “Create User”.

Once the user is created, you need to add the user to the database and check the “All Privileges” option to give him full control over the database.

After that, you should click the “Make Changes” to save your changes. This way, you can create a MySQL database for the live server.
Step 4: Import The Database to The Live Server
In this step, you will need to import the database to the live server that you have created in Step 3. To start the process, you should go to –
cPanel dashboard >> Databases >> Click on “phpMyAdmin”

Clicking the phpMyAdmin will take you to the database that you just created. The new database will have no tables. After that, select the ‘Import’ tab on the top right corner of the menu bar.
Once the ‘Import’ tab is opened, click on the “Choose File” button. This will give you the option to upload the database from your local storage that you have created earlier.

Next, hit the ‘Go’ button at the bottom of the page and the phpMyadmin will begin to import the database automatically.
Step 5: Change the Website’s URL
Once you have successfully created and imported a MySQL database, you have to change the URL of your WordPress site. The process starts with changing the URL in the database so that it can connect with the live website.
Search for the wp_options table inside the database (under phpMyAdmin) that you just imported in the earlier step.
Note:
If you have changed the prefix of the database, then you may look for the {new_prefix}_options instead of wp_options.
Okay! Next to the wp_options, you will see a ‘Browse’ button. Click on the button to open the list of fields that are inside the wp_options table.

Look for the siteurl option inside the options_name column and hit the ‘Edit’ icon to open the corresponding window to edit this field.

In the input field next to the option_value, you will find the URL of your local server, which can be something like –
http://localhost/test
Alter this link with the URL of your live server, for example –
http://codeastrology.com/
Next, click the ‘Go’ button to save the changes.

After that, you have to follow the same procedure to change the home option name. The wp_options menu can be a few pages long and you can find the home option on the second page.
In the same way, update the home URL in accordance with your live site.
Step 6: Configure Your Live Website
Now that you have finished importing necessary files, databases, and changed the website’s URL; it is time to set up your WordPress site. You will notice your website is showing an error message like the below –
“Error establishing a database connection”
So, how do we fix this? Well, connect to your FTP client and look for the wp-config.php file. Open the file and look for the following lines of code –
// ** MySQL settings – You can get this info from your web host ** // /** The name of the database for WordPress */ define( ‘DB_NAME’, ‘database_name_here’ ); /** MySQL database username */ define( ‘DB_USER’, ‘username_here’ ); /** MySQL database password */ define( ‘DB_PASSWORD’, ‘password_here’ ); /** MySQL hostname */ define( ‘DB_HOST’, ‘localhost’ ); |
Here, provide your database name, user name, and password in the following way –
- ‘database_name_here’ → Give the name of your database that you have created earlier
- ‘username_here’ → Give the username
- ‘password_here’ → Give the password
After providing the credentials accordingly, save the wp-config.php file and upload it to the WordPress hosting server.
Now you will find your WordPress site on the live server.
But the work is not done, there are some configurations in the WordPress admin panel. Go to –
Settings » General
Don’t change anything now. Scroll down at the bottom of the page and hit the “Save Changes” button. This will allow your WordPress website to accept the new URL and apply the same policy in all other cases where it needs to be done.

Once you are sure that everything is ok, go to –
Settings » Permalinks
Similarly, don’t change anything here. Just scroll down at the bottom and click the “Save Changes” button to make sure all the post links are working fine.

You might be interested in – The Ultimate Trick To Add a Password Protected Post or Page |
Step 7: Update Paths to Fix Broken Links and Images
No matter how smoothly you move a WordPress site from the local host to the live server, you will get some broken links and miss some images.
Luckily, updating the broken links can be done easily. To do this, click on the database after going to phpMyAdmin. Click on the SQL tab on the top menu bar and the following SQL query
UPDATE wp_posts SET post_content = REPLACE(post_content, ‘localhost/test/’, ‘www.yourlivesite.com/’); |
Make sure you have changed the above SQL in the following way –
- ‘localhost/test/’ → You should insert your local URL
- ‘www.yourlivesite.com/’ → You should insert your live URL
Click the ‘Go’ button to save the changes.

What’s Next After Uploading WordPress Website from Localhost to Server?
No matter which method you have chosen, it will get the job done. Moving a WordPress site from a local server to a live server is not that difficult, we are sure you feel the same after reading this article.
At the end of this discussion, we would like to suggest checking everything thoroughly after uploading your website to localhost to the live server. Make sure you have the necessary backup of the entire website. Because if something goes wrong in the local server and if you accidentally upload it to the live server, you may need to roll back. So, you should have an automated backup system for your website. On top of that, it is wise to take a manual backup of your website and database when you are working on something critical and big.