migrate wordpress files from localhost to live server

How to Safely Move WordPress From Localhost to Live Site: A Guide

To move WordPress from localhost to live site can be time-consuming, intimidating and risky (especially if you are a newbie to WordPress). However, It’s really good to build a website locally for speedy development using software like XAMPP, WAMP (for Windows) or MAMP (for Mac). I recommend using XAMPP as it is very easy to use.

Also, building a website locally allows you to test different themes, templates and plugins, saves you from unnecessary headaches of your site breaking while troubleshooting and so on.

Once you are satisfied with the design of your website on localhost, you can migrate WordPress from localhost to a live server in order to share your designs with the world. It is quite easy though sounds tough.

Meanwhile, in this guide, I will give you a step by step walkthrough on how to move WordPress from localhost to a live server manually in cPanel, without the use of a plugin.

Note that in these steps, to move WordPress to a new server, you have to do the following:

  1. Migrate WordPress files of your local site to the live site.
  2. Migrate the database from the local site to the live site.

Let’s get started:

Step #1

web hosting

First of all, you need a hosting plan to install and upload your WordPress website. I recommend using WhoGoHost. They are reliable, secure and provide fast web hosting services.

Step #2

softaculous apps

Log into your cPanel account and scroll down to the section called “Softaculous Apps Installer”. Click on the WordPress Icon to install WordPress in a live server. Learn how to install WordPress in one simple click.

Step #3

cPanel file manager

After installing WordPress, click on File Manager in your cPanel dashboard. Navigate to the “public_html”/root There you will see your WordPress configuration files and folders (i.e if WordPress is installed in the root folder).

Step #4

navigate to wp-content folder

Now, go back to your localhost website files in your desktop. Navigate into the wp-content folder.

Step #5

create a new folder

Create a new folder, and rename it to be called “wpitems”.

Step #6

copy plugins,themes and uploads folder into new folder

Select the plugins, themes and uploads folders, then copy these three folders into the newly created “wpitems” folder. Lastly, compress (zip) the “wpitems” folder. Learn how to compress (zip) a folder in your computer.

Step #7

navigate to your localhost database

In your browser, go to the localhost database by entering “localhost/phpmyadmin” in the address bar.

Step #8

select a database

Then select and open the database currently being used by your localhost WordPress site.

Step #9

Export the database

Navigate to the Export tab. Scroll to the bottom of the page and click the Go Your localhost WordPress site database will be exported in a “.sql” file format.

Step #10

Let’s now complete our WordPress set up in cPanel. In your website root folder (public_html), Navigate to the wp-content folder. Delete the “plugins”, “themes” and “uploads” folder and click on upload in the top navigation bar.

Step #11

drag and drop folder

Drag and drop the zipped “wpitems” folder from the localhost files into your browser and wait for it to complete uploading. After its complete upload, go back to the wp-content folder in cPanel and click reload. Now you should see the uploaded compressed (zipped) “wpitems” folder.

Step #12

extract item

Select the zipped “wpitems” folder and click on extract in the top navigation bar. After extracting the zipped folder into your wp-content folder, click reload to view your extracted “wpitems” folder.

Step #13

move files

Navigate into the extracted “wpitems” folder. Select the “plugins”, “themes” and “uploads” folder altogether and click move in the top navigation bar.

A pop- up menu will appear, showing the directory to which you want to move these three folders to. Remove the “/wpitems” and click the Move File(s) Navigate back to the “wp-content” folder by clicking “Up One Level”.

Now you should see all three folders recently moved, the zipped “wpitems” folder and the unzipped empty “wpitems” folder. Select and delete both folders labelled “wpitems” (zipped and unzipped).

Now you have the three recently uploaded folders (plugins, themes, uploads) and an index.php file. Great Work, we’re almost done.

Step #14

wp-config file

Next, navigate back to your root folder (public_html) and look for a file labelled wp-config. Select it and click “Edit” in the top navigation bar to edit its content.

Step #15

edit wp-config file

In your wp-config.php file, you will see a lot of codes and comments. Do not be overwhelmed by that. Click CTR + F to find a particular text, in the pop-up shown type “$table_prefix” to find the table prefix of the current live WordPress database.

Change the value to ‘wp_’ or whatever the prefix of your localhost WordPress site database is. For example: ‘wp896_’ to ‘wp_’. And click Save Changes then close.

Step #16

Now, locate the folder where you downloaded the exported localhost database we talked about in “Step #9”. Select it and open with a text editor or IDE. I recommend using the Sublime Text text-editor for beginners as it is light and easy to use (there are other text editors you can use also).

After you download and install Sublime Text. Select your exported “.sql” database file, right-click and open with Sublime Text.

Step #17

edit localhost database

When you open the exported localhost “.sql” file in Sublime Text Editor, you will see a lot of codes. Not to worry again, click CTR + F to find. In the find search bar below type “http://localhost/sitefoldername” and click on Find All. It would select all text relating to “http://localhost/sitefoldername” (replace sitefoldername with your localhost site folder name).

Then replace all highlighted text with your new live WordPress site URL: e.g “http://newlivewordpresssite.com” (replace newlivewordpresssite with your domain name). And save the file with CTR + S.

Step #18

drop existing tables

Go back to the cPanel dashboard, click on phpMyAdmin under the Databases section to open the databases dashboard. Select and open the live WordPress site database currently in use.

Navigate to the Export tab in the top navigation bar and export the database (just to be safe, though not needed anymore). Then Check all tables in the database and click drop to delete the current tables of the live WordPress site.

Step #19

import new modified tables from localhost to live site

Finally, Navigate to the import tab, Click on the choose file button, and select the newly modified localhost WordPress site database. Scroll down and click “Go” to import.

Step #20

Now you can reload your live WordPress site in your browser to ensure everything is up and running smoothly.

That’s all, you have successfully migrated WordPress from local server to a live site!

P.S: To log in to your new live site /wp-admin dashboard, Use the login information used when installing the WordPress site on localhost.


Conclusion

To move WordPress from localhost to live site might seem difficult and daunting at first sight. However, taking the right steps with guidance correctly will get you your desired result in no time as it takes only a few steps to do it manually.

Congratulations to you if you made it this far in moving your WordPress site from localhost to live server. You should know that you are no more a newbie to WordPress as far as taking these steps correctly and carefully is concerned.

If you like this article, Kindly like our Facebook, Twitter and Instagram page to receive more helpful tips about WordPress. Also, check out our amazingly affordable web design and digital marketing services to help grow your business at a fast pace. And lastly, don’t forget to share with friends on all social platforms so as to save them from unnecessary headaches. Good luck!

Are you still having problems while trying to move WordPress files from localhost to live site, or you are stuck in one of the steps above? Leave a comment below, and we would respond to fix your needs as soon as possible.

 

Leave a Reply

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