If you have successfully created your WordPress site on the localhost then you might want to make WordPress site live. But if you don’t know how to transfer WordPress site from localhost to live server then you are at right place. Here, we will give you a step-by-step guide on WordPress local to live.
How to Transfer WordPress site from localhost to live server
1. Upload WordPress files from localhost to live server
2. Create Database on Server
3. Create a Database user on Server
4. Export Database from local to live
5. Update wp-config.
Before making a WordPress site live, it’s always good to have a WordPress site locally. This will save you from making an embarrassing mistake live on online as well as it can be utilized as site back up. But, if you have not created a WordPress site locally yet, you can follow our guide on how to install WordPress locally.
However, if you have already created one WordPress site on your computer you might be willing to transfer the WordPress site from localhost to live server. If you are going to make WordPress site live then you have visited the right place, here we are going to look at each and every step from WordPress local to live.
Step 1: Upload WordPress files from localhost to live server
To make WordPress site live, the first thing you need to do is to upload all the files and folder of WordPress local to live. This can be uploaded either by one of two give methods.
The first way to way to transfer WordPress site from localhost to live server is by directly uploading files through cPanel admin.
- Zip local WordPress site: Firstly, zip all files and folder inside your main WordPress directory. For example, if we have a folder “noobietech” inside “C:/XAMPP/htdocs” then we need to compress all files and folders inside “noobietech” directory.
- Upload Zipped File: Secondly, upload this zipped file to “cPanel Admin =>File Manager => public_html” directory on the server. On some hosting, you can see this “public_html” folder as combined “public_hml/www”. This is the root directory of the live server. But, if you want to install WordPress on some subdomain then you need to upload this zipped file to that subdirectory.
- Extract uploaded zipped files: Finally, extract these zipped files inside the “public_html” directory. But, as mention above if you are installing WordPress in the subdomain, you need to extract it in the subdirectory.
In some cases, you might not have access to cPanel admin or let’s say you want some others to upload files for you but don’t want to provide cPanel details then you can use FTP method to transfer WordPress site from localhost to live server.
- Create FTP user: To get connected through FTP, you will need to have an FTP user. However, if you have not created one yet you need to create one at first. To create FTP user you need to login to cPanel admin then go to FTP accounts, enter desired username and password there to create your FTP account.
- Download FTP client: Next, you need to download the FTP client. The most popular FTP client is FileZilla FTP client. Download Filezilla FTP client, if you don’t have already.
- Connect FTP to server: To connect to the server through FTP you need the username, password, and hostname. Connect Filezilla FTP client by following steps:
- Click on File.
- Click on Site-manager
- New Site
- Enter Site Name to recognize this connection later
- Enter the hostname and port. Generally, FTP servers use port 21, SFTP servers use port 22 and FTP over TLS (implicit mode) use port 990 by default.
- Select “login type” as “Normal’
- Enter username and password
- Upload Files: After successfully connecting to the server, you can start uploading files to the server. You need to upload files to root directory “public_html”. But, you need to upload to some other directory if you are planning to install WordPress in a subdomain.
Step 2: Create Database on Server
After successfully uploading files from WordPress local to live, you need to create the database on the server. To create the database:
- Go to cPanel admin => MySQL Database
- Enter Database name
- Create Database
Step 3: Create a Database user on Server
After creating the database, you need to create a database user who has privileges to this database. You can create database user on the same page, where you have created the database.
- Go to cPanel Admin => MySQL Database
- Enter Database username, password and hit create user
- Add this newly created user to the recently created database
Step 4: Export Database from local to live
Next important step is to export the database from the local server to the live server. You need to be extra careful to perform this step.
- Export local database
- Firstly, go to “localhost/phpmyadmin“
- Next, click on the WordPress database and export that
- Replace local address with the website address
- Open that exported SQL file in one of the text editors such as notepad++, sublime.
- Find the local WordPress site name and replace with your website name and save it. For example, if your local web address is “http://localhost/noobietech” then you need to find this text and replace with “https://noobietech.com”
- Import saved SQL script
- Go to cPanel admin => PHPMyAdmin on the webserver.
- Click on the newly created database
- Finally, import SQL script
Step 5: Update wp-config
Now, its time to update the wp-config file to connect to the server database and make WordPress site live. For this, go to ” cPanel Admin => File manager => public_html => wp-config”.
Furthermore, you need to edit this wp-config file, update “DB_NAME, DB_USER, DB_PASSWORD, DB_HOST” as your database name, database username, database password, and database host. Generally, this DB_HOST is “localhost”, but some hosting company might have different DB_HOST name.
After following all this step, you have successfully transferred the WordPress site from localhost to live server and make WordPress site live.
I hope this article is really helpful for you as I have mentioned all the necessary steps that encounter in the process of WordPress local to live. But still, if you encounter any problem while trying to make WordPress site live you can raise your issue in comments.