Developing a WordPress website on localhost is a secure and effective method to build a website. There is no need to worry about the limitation of disk space and bandwidth. Also, that leaves enough time for webmasters to get everything ready before making the site public. However, when transferring WordPress installation from localhost to live server, you probably mess up all things.
Here, we make this step-by-step guide to help you have all things completed successfully. That would mention the preparations before website migration before everything.
Make Some Preparations
Create a Website on Local Server
Before everything, you need to create a website on localhost and get all things ready. Test if there is something wrong with each web page. Make sure that you website is accessible to visitors once being migrated to a live server. Here, we suggest you to create a local WordPress site using XAMPP.
Backup Your Website
Don’t forget to backup your website for fear of data loss or file damage during the website migration. Do it manually or take advantage of a WordPress backup plugin, like BackUpWordPress, BackWPup, WP-DB-Backup, and so on. Backup files, images, posts, databases, and anything included in your website.
Select a Trust-Worthy WordPress Web Host
Make a decision on which web host is selected to host your WordPress website. A quality WordPress hosting provider can deliver excellent uptime and fast speed to your site. The rich resources and user-friendly control panel are also included in each solution.
cPanel includes FTP manager and phpMyAdmin, which enables an easy and secure way to migrate local databases and files to a live server. As thus, we suggest you to select a WordPress hosting package coming with such powerful control panel.
The following companies regarded as the best WordPress hosting providers with cost-effective and high-quality services. Each company utilizes the most powerful cPanel. And then, sign up an account on the selected web host.
Having all preparations done, you should set about moving your WordPress site from localhost to live server. Note that, we would like to complete the website migration via cPanel.
Step 1: Export Database from Local Server
Once installing WordPress on local server, you are required to enter the database name, username, password, database host and table prefix. Keep the database name in mind. Here, we are going to export database from localhost by using phpMyAdmin, which is an open source software designed for MySQL database management.
Log into cPanel and go to Databases > phpMyAdmin. And then, target you database from the left sidebar. Once clicking the database name, a list of option tables is shown on the interface. Move to the menu bar and click “Export” tab. Select an export method from the two options and then click “Go” button to start exporting the local database. The database will be downloaded on your computer.
Once creating a database on local server, by default, the link to all database files would be like http://localhost/. Here, we suggest you to replace the link structure to http://yoursite.com/. That ensures all web content will display on your live site normally. Open the export database file in any code editor as needed and replace the original link to a new one.
Step 2: Create a New Database on Live Site
Create a new database on your live site. The content included in the local database will be transferred to this new database. Go to Databases > MySQL Databases and access to an interface for MySQL databases management. Type a name for the new database and click “Create Database” to confirm settings.
Scroll down the page and move to MySQL users settings. That allows you to create a new user. Set the username and password according to personal needs. And then, add this user to the new database and enable all privileges for this new user.
Step 3: Import Local Database Files into New Database
Go to Databases > phpMyAdmin and target the database you’ve created just now. There is no table included in this new database. Click “Import” tab and choose the local database file you’ve exported in the step 1. Press the “Go” button to start importing the selected database file. That would take you tens of seconds. And then, the notice “Import has been successfully finished” indicates the fulfillment of database import.
If there is a need to modify database details, go to Files > File Manger and open the wpconfig.php file in a code editor. Change the database name, username, password and localhost if needed.
Step 4: Upload Files to Live Server
Upload files from local server to live server using FTP client. Here, we would like to complete this step by using FileZilla. Enter the host name, account username and password as required and connect this FTP client to your live site. The FileZilla client interface should be as below.
Target the root directory that includes all files on local server from Local Site section. And then, select a category from Remote Site section and this is where to place all files transferred from local server. Select all files on local server and then check “Upload” option. After a while, the files will be uploaded to your live site.
Step 5: Set Up Permalinks
Make sure that the permalink structure on the new site should match with the local site permalink structure. Otherwise, the web pages cannot be accessible to visitors. Log into your new site and go to Settings > Permalinks and select a proper permalink structure from the list. Also, you are allowed to customize the permalink if needed.
Having all settings done, access to each web page from front-end and check if all pages are accessible. If there is a need to enable a unique web design and more functions to your website, we suggest you to make use of some premium WordPress themes and plugins.