Great, you are done developing and testing your WordPress website on your local setup. You have ironed out all the problems and are happy with the results.
What next? The next step is to make it live, so your users can get to it.
The big question is, ‘How do you go about migrating your WordPress site from your localhost to the live server?’ Well, that is what this article is all about. We will cover two ways to help you publish your WordPress website:
Using a plugin
We recommend the first method as it is easy for both techies and the not-so-tech-savvy. Also, this method works seamlessly for all hosting providers. However, do go through the manual method as well, in case the plugin fails (for whatever reason) or you want tighter control of all the aspects of migration.
Let us jump right in.
Migrating WordPress site to live server from a localhost
While we are going to use the Duplicator plugin for this article, you can use any other suitable plugin. Here are a few that you could consider:
All-in-One WP migration
UpdraftPlus WordPress Backup Plugin
WP Migrate DB
Step 1: Install and activate the Duplicator Plugin on the localhost
Start by installing and activating the Duplicator plugin on the WordPress site hosted on the localhost.
Navigate to ‘Add Plugins’ and search for ‘Duplicator’. Once you find it, click on ‘Install Now’
Do not forget to activate the plugin after installation completes.
Step 2: Create a package
Package here refers to two files: a zipped archive of your website and an installer.php file to install the archive contents on the live server.
To get these files generated, you first need to create a package.
On the left, navigate to the Duplicator menu on the menu bar,and click the Packages submenu. Next, click on the ‘Create New’ button that shows up on the right hand corner of the screen.
Fill in the package name and press ‘Next’ on the next screen.
Once the scanning is complete, you will see a screen with a ‘Build’ button at the bottom. Click it to start building the package.
The building may take some time. Once completed, it will create a zipped archive that contains your website’s content, plugins, themes, database and all the WordPress files.
Once the Duplicator plugin has built the package, you will be presented with a screen that allows you to download the generated files to your computer. You can choose to download the Archive and Installer separately, or together, by using the ‘One Click Download’ option.
Step 3: Use an FTP client to transfer the Archive (ZIP) and installer.php to the live server
Once you have the generated archive and installer.php, you need to transfer these files to the live server where they can be used to prepare a WordPress installation for your live website.
You can use any FTP (File Transfer Protocol) client for this purpose – we prefer FileZilla as it is free and the most popular one out there. FileZilla also allows you the option to use SFTP (Secure FTP) to transfer your files over a secure connection.
Enter the hostname and FTP/SFTP credentials of your live server to make a live connection.
Upload the Archive and installer.php to the root web folder (usually public_html) on your live server (you will find these files in the location you downloaded them to in the previous step)
Step 4: Run installer.php on the Live Server
Now that you have the required files on the live server, it is time to execute installer.php.
Point your browser to http://<yourdomainname>/installer.php. This will launch the Duplicator installer. Simply click on ‘Next and keep moving.
NOTE: Before moving to the next step, you may want to remove the previous data (if any) from the live server database. You can use the Database Manager to do this. This will reduce the chances of any leftover data causing any kind of issue later.
The next step will ask for your database credentials. Fill in the required information and click on ‘Next’.
Step 5: Update site data and test live website
Confirm the settings on the next screen and click on ‘Next’.
Click the ‘Admin Login’ button on the ‘Test’ screen and your familiar wp-login will popup.
Login and navigate through the site and ensure everything is as you want.
Congratulations! You have successfully transferred WordPress site from localhost to server, with the plugin handling all the complexities of the process.
Migrate WordPress site to the live server manually
In Migration of WordPress manually, you can use different tools to export database files from local setup and import it to live server as well there are also FTP clients, cPanel to transfer WP files.
Step 1: Transfer WordPress Files to the live server
Use any FTP client; go to the root folder of your WordPress installation on your local server. Connect to your live server and upload all the contained files to the public_html directory of your domain directory.
Using cPanel to achieve the same is also perfectly fine.
Step 2: Export the local database
Using the phpMyAdmin on your local server, select your WordPress database on the left and use the top menu bar to navigate to Export.Quick Export Method, and click on ‘Go’.
This will create a ‘.sql’ file in your download file, containing the commands for your exported database. You can also choose to export to an archive file instead of creating an SQL file.
Step 3: Import the database on the live server
You can either use the phpMyAdmin interface or Database Manager.
Import the DB file you generated in the previous step to the live server database. Make sure the newly created database has the needed privileges for the DB user.
Step 4: Update the values for siteurl, home and blog name options
Navigate to the wp_options table, and click on ‘Select Data’
You need to change the values of siteurl, home and blog name to your website’s URL.
Step 5: Update your wp-config.php
Once you are done setting up the DB and getting all your files to the live server, you may need to change some settings on the wp-config.php to match them with your database.
Verify these settings:
define(‘DB_NAME’, ‘database name’);
define(‘DB_USER’, ‘database user’);
define(‘DB_HOST’, ‘server name holding your database (usually localhost)’);
Step 6: Activate your SSL certificate on the live server
Finally, protect your live WordPress website with a best SSL certificate. (assuming you have already installed it on the live server).
Introduce these two lines in wp-config.php just above the line that reads ‘/* Tdefine(‘FORCE_SSL’, true);
That’s it. You now know of two ways to migrate WordPress from localhost to server. Choose a plugin to make things easier. Or, use the manual method if you want more control over the steps. You are now ready to showcase your WordPress website to the world.
To know more about WordPress CMS, hosting and features of WordPress, read more from our WordPress SEO Planning .
Migrating WordPress from localhost to server might seem like a difficult task but it isn’t. Follow these two steps to easily transfer your website.