Rehmat Alam A blogger who has fallen in love with coding! Here at SupportiveHands.net, I share things that relate to coding, servers, E-marketing, and other related fields.

How to Move a WordPress Blog from Localhost to Live Server

4 min read

Have you developed your WordPress blog using WAMP or XAMP server? Is it now ready to be uploaded? If your answer to these questions is yes, then you will learn here how to move your locally developed blog to a live server with extreme ease. This tutorial will simply guide you through all steps and after reading and understanding the steps, you will be able to make the move successfully.

Step 1: Purchase Hosting and Domain

First of all, purchase hosting on a reputable WordPress host. I will recommend you to use HostGator as it is both affordable and stable at the same time. I’m also using HostGator for my own blog at the time of this publish. If you haven’t purchased the hosting yet, purchase any plan with HostGator. Use supportive as coupon code to get a 30% discount on any hosting package you choose.

With hosting purchase at HostGator, you will be given a free domain too and the domain will be setup automatically at hosting server. If you are going to use any domain registered with any other registrar, then first redirect it to your hosting server. Once the hosting is purchased and domain is pointed to your hosting servers, then proceed to next step. If you are facing difficulties in setting up this all, simply contact your hosting support or ask me via contact form.

2. Create a MySQL Database

After setting up the hosting server and pointing the domain, login to cPanel and create a new MySQL database. To create a new database, select “MySQL Databases” option from cPanel interface first.

create-database

At new window, create a new database by entering a unique name and press “Create Database”. Note down the name which you provide for the new database. For example the database name, which I’m going to create for showing you the demo, is shands_testdb

provide-database-name

After creating the database, press back button to reach MySQL Databases page and scroll down the page to reach MySQL Users section and create a new user for the database. Choose a complicated password for the user and press “Create User” button.

create-user

 

After creating the user, again press back button to reach the MySQL Databases page and scroll down to MySQL Users section. Now add the user to the database which you have created earlier. In user option, select the user which you have created earlier and in Database option, select the earlier created databases and press Add button. On next page, assign all privileges and add the user.

add-user-to-database

Now note down all details accurately. You need to remember or note down MySQL database name which you have created earlier, the user name which you have created and added to the database and the password which you have set for the user.

3. Export Database on Localhost

Next, go to phpMyAdmin in localhost (WAMP or XAMP server) and export the database at which you have developed your blog locally. View below screenshot for help regarding this.

export-database

After pressing Go button, you will be prompted to save the file. Save it. Don’t forget to click concerned database from left sidebar after launching phpMyAdmin, otherwise the Export option may not appear on interface.

Edit URLs in Database: Now open the exported database file (yourdatabase.sql) in DreamWeaver or any other editor and search for localhost by pressing Ctrl+F. After finding localhost, replace it with your blog domain. For example in my blog’s case, I’ll replace localhost with www.supportivehands.net. The editor will replace all occurrences in one click. For this purpose, I would recommend you to use DreamWeaver. Save the changes after replacing localhost with your domain name. Don’t forget to consider www while replacing localhost. If you are going to use www before your domain, then replace localhost with www.yourdomain.com or if your don’t want to use www before your domain name, then just replace it with yourdomain.com.

4. Import Database to Server

After making the changes to database file, again sign into cPanel, scroll down to Databases section and go to phpMyAdmin. There, select your database from left sidebar (which you have created earlier in second step) and click import tab. There, click Browse, select the database file which you have exported from phpMyAdmin in localhost earlier (and have made the changes to URLs) and click Go button. Wait a few moments, the database will be imported.

import-database

5. Important Files

There are two options, first you can install WordPress using one-click installers and can replace wp-content directory with the one on localhost, or upload all files including WordPress core directories which are on your local server. The second option is simple and less confusing, so I’ll guide you through it.

To upload files, sign into to cPanel again and go to root directory of your domain via Fila Manager. Now leave this window open and switch to your blog directory on local host and compress all files and folders including wp-content, wp-admin and all other files. Then switch back to File Manager page and upload the zipped file to root directory of your domain on hosting server using File Manager uploader. Once the upload completes, decompress all files and directories in the root directory of your domain.

Alternatively, you can use any FTP client for uploading files too. To make the tutorial less confusing, I haven’t discussed about it.

6. Edit wp-config file

After the files upload to the directory (and you decompress it), open wp-config.php file for editing and replace the database name, user name and password with the values which you have got before in second and third steps. After making the changes to wp-config.php file with necessary details, save the file and close editor. Now visit your blog URL, you will see the blog in action like it was on your local server.

edit-wp-config

Can’t We Use Import/Export Feature of WP? Many newbies ask me that either this can be done via import/export feature of WordPress? The answer is both yes and no. Using import/export feature, you can only upload posts, comments and pages etc. This method has several disadvantages one of these is the breakage of links to media files. For example the links to posts in images will break if the image was on local server.

But when you move your blog through the method I described here, it will keep your all blog settings including plugin configurations, image links and all other setups intact and your blog will be moved to live server with an appearance exactly like how it was appearing on local server. The move transfers your all files safely and neatly.

So in this tutorial I have tried my best to make you understand regarding moving a locally developed WordPress blog from localhost / local server to a live server. If you are still confused on how to make this move, just ask me via contact form. I’ll help you directly.

 Didn’t Have Purchased Hosting Yet? Purchase an affordable and a reliable WordPress hosting at HostGator here. Use supportive as coupon code for 30% discount.

Rehmat Alam A blogger who has fallen in love with coding! Here at SupportiveHands.net, I share things that relate to coding, servers, E-marketing, and other related fields.

PHPMailer: Called Mail() without being connected cPanel/WHM

PHPMailer is the most trusted PHP class to send emails that provide a complete set of features to enable you to send emails the easy...
Rehmat Alam
1 min read

How to bulk delete posts by a user in…

vBulletin is the most powerful forum software out there but sometimes its complex (or I can say that the ugly) administration control panel makes...
Rehmat Alam
1 min read

How to Backup and Restore a Large MySQL Database

phpMyAdmin is the most familiar tool for database management on small and medium-sized websites and blogs. This free tool makes the task of database...
Rehmat Alam
1 min read

Leave a Reply

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