Skip to content
Home » Blog » How to Change a Localhost Site Into a Live Site With a Plugin and cPanel

How to Change a Localhost Site Into a Live Site With a Plugin and cPanel

  • Learn

Install WordPress on a live site with a Plugin

Since the live site has a default interface on the front end of the site, we need to transfer our customized localhost data to the live site.

For, the data transfer, we use a plugin.

Plugin Download

For data transfer, we need to download a plugin, or any kind of data migrator plugin on a localhost site and on a live site as well.

Make a .zip file of all the data of the customized localhost site and export it as a downloaded folder on your pc.

If Xampp is your localhost, then,

  • Go to Xampp in Local Disk
  • Open htdocs
  • Make a zip file of your localhost folder

Now, install the same plugin on the live site. Go to the settings > import and import the zip file on your live site.

After exporting the file, apply all the data on the live site and refresh.

Your live site will be launched with the data of the local host site.

 

CHANGING A LOCALHOST SITE INTO A LIVE SITE WITH CPANEL

Since we’ve created our customized site on our localhost, all we need to do is export the data of the localhost site to a live site. But how do we do this?

 

As we have bought the domain and hosting for our site, we are provided with the link to access the cPanel through our hosting provider in order to upload our localhost data to our live site.

Localhost

As your folder name and the database name is the same in your localhost, you need to open the localhost on your htdocs and compress the folder into a zip file for its upload procedure which will be used later.

  • Get Inside the localhost folder
  • Select the localhost site folder
  • Right-click to add to the archive
  • Change the archive format to .zip.
  • Click OK to save

Now we have a zip file ready of our localhost site, it’s time to run localhost/PHPMyAdmin on your explorer and export all the databases to save it on your PC. Remember, if you’ve multiple sites created, then you need to export the database which you zipped previously to add it to a live site. For that, 

  • Go to localhost/PHPMyAdmin
  • Go to the Database name
  • Select Export
  • Then Save the file (The file gets saved in SQL form.

The work of creating the files and folders for the upload procedure is completed.

Now, it’s time to move all the localhost files into your live site with the help of cPanel.

 

Live Site

After you buy the domain and the hosting, you get an email with the link to access the cPanel of the site with the cPanel username and password provided to you through your email.

After you’re on cPanel,

  •  Go to File Manager
  • Click public_html
  • Click the upload icon 
  • Upload the zipped localhost folder
  • Now extract the zipped file fully inside the public_html and you can delete the zip folder after the extraction.

The next thing to do after file upload is, to create a database, username, and password which will be used for login purposes. For that,

  • Go to MySQL Databases
  • Create a new database (You can see the prefix username of the cPanel)
  • Create a new user (Remember the username)
  • Create a password ( Remember the password as well)
  • Add your user to the database
  • An interface arrives where you need to tick on all privileges and apply.

Your work of creating the database on SQL Databases is completed.

Return to the file manager in cPanel where you extracted the zip file. There you can see the “wp-config.php” file which needs to be edited in some parts. For that,

  • Right-click on wp-config.php
  • Click on edit

You can see the PHP file gets editable in a .txt format.

On the interface, you can see,

  • Define (‘DB_NAME’, ‘Your localhost name’);
  • Define (‘DB_USER’, ‘root);
  • Define (‘DB_PASSWORD’, ‘-’);    (The empty space to add your password)

Those localhost names need to be updated with the database name, user, and password that we created earlier. Now add the database name, user, and password you created on My SQL Databases on cPanel.

  • Define (‘DB_NAME’, ‘Your new database name’);
  • Define (‘DB_USER’, ‘new username);
  • Define (‘DB_PASSWORD’, ‘the new password that you created); 

Now press the save button and close the page. Click on save changes and save the file.

Till now, we created a .zip file and uploaded it to the public_html. Created databases with user and password and now we just edited the PHP file adding our new database names and passwords.

Remember we also imported the localhosts file in SQL format? It’s time to make good use of it.

We need to upload the .sql file on our live site i.e. in the PHPMyAdmin panel of the cPanel. For that,

  • Go to cPanel
  • Go to PHPMyAdmin
  • Go to your newly created database
  • Click on Import
  • Import the SQL file that we saved earlier
  • Click GO to save it

Last but not the least, we’ll be left with a few edits to make. 

You can see the wp_options table on the database that you just set up.

On the option_name section, you’ll see “Site URL” and “Home” which will have your localhost site name on the “option_value”.

Change those names to your domain name. For that,

  • Click on the option_value of the site URL
  • Click to change its name to your domain name
  • Use https://www.’yourdomainname’.com as the URL
  • Add the same URL on the Home Option_value
  • Press Enter
  • Reload the Page

 

After this is done, go to the search engine and type the domain name to see if the site loads perfectly. Once you assure that the site is the same as you created on the localhost, you can edit and make changes to your site by simply going to the domainname.com/wp-admin. Your site is LIVE. Enjoy

 

Share Your Thoughts

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