You might have already built yous site at localhost. Creating your site at localhost is the best option, as it save a lot of time and bandwidth.
Hosting a WordPress site or moving a WordPress site from localhost to live server isn’t that hard to do it. Just follow all the steps as I have mentioned below.
I assume that you have your WordPress site at your localhost. So to host your WordPress site, first you will need a hosting account and a registered domain. If you still haven’t bought any hosting plan, then you can check some of hosting service providers.
Let’s get started.
Step 1: Login to your Hosting account. For demo purpose I am using BigRock’s hosting account. You can use your own hosting account . Login to you hosting C-Panel.
Step 2: First of all, we need to create a database. Goto to “MySQL Database” given in your C-Panel
Step 3: Now you need to create a database name. So enter your database name as you want.
Step 4: Now create a User for your Database.
Enter your Username (as you like) and Password.
After creating User, now add this User to your Database. This user will be the admin of this database, so remember your password.
Step 5: Assign “All Privileges to the User”. Select your Username.
Step 6: Select “All Privileges”.
Step 7: Now you have created you database at your hosting server.
Now you need to upload your localhost database to your hosting account database.
So goto your localhost database. You can find your locahost database at “localhost/phpmyadmin”
Select your database (shown as 1). Select all tables, click on “Check All”(2) and then “Export”
Step 8: At next page, at the bottom of the page, just select “gzipped” and Click on Go. A gzipped file of your localhost database will be created.
Step 9: Now you need to upload this gzipped file to your server database.
So goto to “phpMyAdmin” present in your hosting account C-Panel.
Step 10: From your “phpMyAdmin”, from left panel select your database(which you have created in step 3), then click on “Import” and upload your gzipped file. After successful upload, you will find all your local database files are uploaded to your BigRock’s database.
Step 11: Now we are done with creating database. Now its time to upload your website.
Create a zip file of your WordPress folder present in your C-drive.
I am using “xampp” server, so this is what my path looks like “C:\xampp\htdocs”
Before creating a zip file of your wordpress website, you need to edit your “wp-config-sample.php” file. Enter the details as given below:
- DB_NAME = your database name
- DB_USER = your database username
- DB_PASSWORD = your database password
After entering above data. Use “Save As” option and save this file as “wp-config.php”.
Now you can create a zipped file of your WordPress Folder. (Don’t create a “.rar” file, only create a “.zip” )
Step 12: Next Goto “File Manager” from your web hosting C-Panel.
Step 13: Your File Manager will look something as shown below:
where “/public_html” is the root path where you have to upload your zipped website. Just Click on Upload and select your WordPress zipped file.
Step 14: After uploading your zipped file, extract it, by using the option “Extract” present at the top panel. Extract the files at the root level (/public_html)
After extracting, you need to move all WordPress files at root level (/public_html), so open your wordpress Folder and move all files using “Move File” option, to your root level (/public_html).
This is how it should look at your root level.
Step 15: Now update your Name Servers, goto your Hosting Panel and find your Name Servers, it will be something like:
Just enter these name servers, at your domain level.
Step 16: Goto your server database again. Select your database, then goto “wp_options” and if you find “siteurl” and “home” same as given in below image, then change “http://localhost/xxxxxxx” with your website URL.
Step 17: Done. Your Website is live now, it takes upto 24-48 hours for the Name Servers to get updated depending on your hosting company.
Once your WordPress website is live, login to your WordPress account. Then goto Setting>Permalinks and Update your post URL types.
Step 18: Sometimes, even after performing all steps correctly, you may find some errors like “Cannot connect to database” or something else. This can be due to your “.htaccess” file present at your hosting account root level (/public_html).
This “.htaccess” file is generally hidden by your hosting provider. Let me if you are having “.htaccess” issues, I will help you out.
Conclusion: By this time you website must be live and you might have got a complete knowledge on how to host a wordpress sites on a live server. If you still need any help or still facing any problem in hosting your wordpress site, comment below and let me know. I will love to help you.