You might be well aware of the word “Localhost” if not, then let me tell you that localhost is the local server that you make on your PC or Laptop. This is the best way to test a website.
A developer always uses a localhost to develop a website because there are a lot of changes and previews involved in the process of website designing.
I understand that a website is the main part of your business and thus you want to give it the best look. Many people, especially bloggers like to customize their website a lot so that their website can give the best possible number of sales and thus a lot of editing and previewing is involved in this process. So investing money just in testing or developing your website isn’t a good idea and thus localhost comes handy for them.
Since quick loading is another factor for ranking nowadays, people work a lot in optimizing their website for performance. They optimize the website so that it generates a lesser amount of requests, load instantly and have the minimum amount of coding.
All these processes need a lot of testing and so localhost is the best option.
Many people visit my blogs daily, and many of them have the same question as for how they can move their WordPress website from localhost to live server?. So I thought to write a detailed post of this.
Given below is a complete guide
After you finish up the designing process of your website, the next process is to move your website to the live server. So, let’s see how to do it.
Before you begin
You need to have few things. The first thing is to let us assume that you have a well-working WordPress website on your localhost and you have its full access.
Preparations before migrating
If you are making a completely custom website, there are many things that you have to preserve before going through the process but, since here we are dealing with WordPress, we just have fewer numbers of things that you have to consider. The preparations that you have to make before, is to make the backup of your website’s database.
Making Backup of database
The database is the most important thing of a website and if you lose it, you lose everything. The database contains all the posts, tags, Url, and many numbers of things in a proper format. So in order to make our live site working properly, making a backup of the database is very important.
The first thing that you have to do is to make backup of your localhost website’s database and thus to do that, follow the steps given below
Click on the database that you have created.
Then click on the Export button given at the menu bar.
On the next screen, choose “Quick” option and format as SQL.
Click on “Go”
This will make the backup of the database, now just download and save it to a safe place on your local PC.
Restoring website to live server
The folder in which you have stored your website is another important part. It contains all the images, media, themes, plugins, and other coding inside. This folder also contains all the efforts that you have made in order to develop the website of your dream.
Uploading the content to live server
Now as we have prepared the backup of all our website data, the next work is to restore our website on the live server.
- go ahead and open the FTP client
- connect the client to your live server
If you want to host your website to example.com, then you must remember that you have to upload the content to Public_html directory.
Now, select all your localhost WordPress files (inside test folder) and paste it inside the public_html folder using FTP client. You can even drag and drop the content.
Making new database
While the process of uploading the content goes on, you can create a database for your website.
Login to your cPanel
Click on MySQL Databases
Click on Create Database and enter the name of the new database
As it’s done, make a new user for your database by clicking on create user
As the process completes, you will be redirected to the permissions page. Here you have to put tick mark on all the boxes and proceed
Click on import button in MySQL
Click on Choose File and then add your computers database file to it and continue
Now you have to change the URL of your website in the database of the live server.
In PhpMyAdmin, look for the column named as wp-options
Click on browse button given next to wp-options
Now you will see site URL under Option_name and in front of that; you will see Edit
Click on it, and you will get a field filled with http://localhost/test
Just change it to http://www.yourdomain.com
Save by clicking on “Go” button.
Now find the “home” tab on the same page and as you find it
Just change home URL to your site URL.
Setting up live site
Now as we have restored everything including the WordPress content, now it is the time to set up our live website.
When you try to open your website you will see that you are getting an error as “Error Establishing Database Connection.” So to fix this, follow the steps
Connect your FTP to live server
Get access to wp-config.php and download it
Now open the wp-config.php file and change the database name, username, and password
Save it and upload it back to the same location.
Now open the URL http://yoursite.com/wp-admin and login to your WordPress dashboard
Go to settings and change the permalink structure same as your localhost
It is done.
Just check, you did it.
Now, as the migration process is completed, go to the complete website once so that you will come to know about the errors. Also, ask your visitors to point out the errors with your website because it’s impossible for you to go through each and everything alone.