So you have already created an astonishing WordPress in your local machine. You now want the website to go live by uploading it to your hosting company. You try uploading like any other normal website that you encounter some problems. This tutorial will guide you through a series of steps until your website goes live. I have done wide and deep research to make sure that it comprises all the important and necessary steps required to upload a local WordPress site to your hosting company. I will be uploading the WordPress site to Cpanel. Below are some of the steps that we will follow to successfully upload the site online.
-
Zip the WordPress in our local machine
-
Export the database files from our localhost
-
Upload the zipped WordPress site to Cpanel
-
Import the database files into our online database
-
Extract our zipped WordPress site and edit the wp-config file
-
Browse our site
Read how to install WordPress on your local machine using Xampp
Zipping the WordPress site
Basically, when working with WordPress offline you require a local server such as xampp or wamp server, in my case, am using xampp. Locate the folder where the WordPress files are stored (in xampp it is htdocs folder and the wamp server is www folder) and zip them using either your default software or any other software for zipping files.
We are done zipping the WordPress site, our next step is to export our database files.
Exporting database files
WordPress stores some of the changes you make while customizing your website in the database. If you fail to upload the database files to your online database then you may experience some problems. In your browser, open http://localhost/phpmyadmin/ and locate the database you created when initially installing WordPress in your local machine. If you don’t remember the database name, locate the wp-config file in your WordPress files and open it, you should be able to see the database name. on opening http://localhost/phpmyadmin/, you will have something similar to the following:
Click the name of your database and click export as shown below.
On clicking the export button, you will have the following. Click the GO button to export your database files.
When have zipped our WordPress site and exported our database file. All the above steps are done offline in our local machine. It is now the time to upload both the files to our Cpanel and configure the site.
Import the database files into our online database
Open your Cpanel dashboard, locate the phpMyAdmin section and click it. It may take some time to open.
The phpMyAdmin User interface looks similar to the localhost phpMyAdmin interface. Click on the database you want to import the database files to. If you have not created any databases, use the MySQL Database Wizard to create one. On top of the phpMyAdmin interface, you will see an import button. Click the import button and browse the file you want to import from your computer.
After browsing the file, scroll down and click GO to import the file. This will take some several minutes to successfully import the files. So you have to give it time or else it will not complete the importation process. After successfully importing the file, you will see the following:
Still in the phpMyAdmin, click on the wp_options and locate the option_value. Under the option_value column, edit the http://localhost/wordpress1 to your website’s URL i.e the URL you visit your website with online. For example, in my case, I will be using my subdomain, http://uploadwordpress.mblog.co.ke/. Therefore, I will replace http://localhost/wordpress1 with http://uploadwordpress.mblog.co.ke/. Click Enter to save. We are done importing our database files.
Upload the zipped WordPress site to Cpanel
Open your Cpanel dashboard. You just have to open the link sent to your email by the hosting company after you purchased the hosting package. Click on the file manager (the dashboard may differ from mine depending on the theme you have activated). Open the public_html folder and locate the upload button at the top of the file manager section and click it.
You can either select the WordPress file from your computer or drag and drop the file for upload. Drag and drop the zipped WordPress file. It will take some time to complete the upload process. A successful upload will show the following:
Extract our zipped WordPress site
Locate the WordPress file you have uploaded. Right-click on the file and click extract. You will be prompted will the following: click Extract file(s).
Open the extracted folder and highlight all the contents. We need to move the content from the current folder to the root of the public_html directory. Right-click on the highlighted content and edit the path as shown below.
Click on Move File(s). locate the wp-config file after moving the files.
Edit the wp-config file
Right-click on the wp-config file and click edit. We have to edit two sections in the wp-config file. The first section contains the details of your database such as database name, database user, database password, and the database host. To edit this section, replace the current details with your online database name, user, password, and leave the host section unchanged.
The second section contains the WordPress auth keys and auth salts. In your browser, open https://api.wordpress.org/secret-key/1.1/salt/, a list of salt and auth keys will be generated. Copy the salts generated and past them under the following section:
After pasting the salt keys, you should have something similar to:
After making the above changes, save the file by clicking on the Save Changes button located on the top section of your online editor.
Browse our site
Your website is now live. Visit the site’s URL and if you followed every step, you should be able to see it.