If you are done with building a WordPress website locally, then you must be wondering how to migrate WordPress from localhost to server? It is quite easy if you follow the right process and that too without getting stuck in between. But, before going into the depth of understanding it, let’s first talk a bit about localhost WordPress.
Localhost in simple words means ‘this computer.’ It means the computer in which the program is running on; it can be your computer or your web server. So now you have understood what Localhost actually is. Now let’s talk about WordPress localhost!
Localhost WordPress is basically a setup in which you have your WordPress website along with its various components, like a database, PHP, and Apache server. To understand the need of making it to the server you need to understand what are the pros and cons of transferring WordPress site from localhost to server:
Ease Of Sharing The Content:
Almost every piece of content is made for the audience, so you may need the easiest way to make it available to your audience. In case you are working only on a localhost, you find it quite difficult to share data with your audience. On the other hand, if it is live on server sharing your posts and content is just one click away. Just write your content, add a few media files and just click the publish button. As soon as your live link is crawled on Google, your audience can easily access it. So, it is one of the reasons to transfer WordPress site from localhost to server.
Source: Google Images
Need for Privacy:
If you are looking for privacy and don’t want anyone to keep a check on your work, then localhost WordPress is recommended in the initial stage. The localhost WordPress helps you to create content, install plugins, test plugins, check out the themes, and work on codes and templates without the worry of getting your data leaked or getting public. So, working on the localhost WordPress is recommended in the initial stage.
Be Secure With the Clone Version:
You need to work carefully while working on the live version of your site. It is essential to update and install plugins and themes from time to time, you cannot mess up on your live site. Sometimes, your site may get deleted due to some errors while working on the backend of your live version of site.
But as we all know, humans are prone to errors, you may also make a blunder on live site. So, if you are also thinking to migrate WordPress from localhost to server, it is always suggested to keep a clone version of your site with you, so in case you make a mess on you live site, you can save yourself with the clone version.
These are some basic pros and cons of transferring a WordPress site from localhost. Now, you must be thinking “how should I move my WordPress site from localhost to server?” Don’t worry! Keep reading to get answers to all your queries!
After talking about the needs, let’s discuss the method of migrating WordPress from localhost to server:
When you are done with making your website locally with the use of various software available like WAMP and MAMP, it’s now time to make it live!
First of all, let’s talk about the elements you need to make a live website. Being prepared in advance is always a good idea! Isn’t it?
The first thing you need is to have a WordPress site running on localhost, and you need to have full access to it, so you may not get stuck in between. Second, you must have a domain name of your website with web hosting. In the beginning stage, it is recommended to have an FTP program.
And the last thing is to get the WordPress migration plugin, which will assist you to easily transfer the WordPress site from localhost to server. When you are ready with all of it, now is the time to start the process. Let’s begin!
Here we will be talking about using a “Migration Plugin” to carry out the whole process, and it is one of the best methods for the beginners.
Step 1- Duplicator Plugin: How to Install and Setup?
The very first step is to install and activate the ‘Duplicator Plugin’ on your local WordPress website. This plugin helps you to create a zip file of your site’s plugins, themes, content, database, and other files. When you are done with the activation, follow these steps:
The duplicator will start running, after a few tests, and when all the items are marked good, you can click on the “Build” button. It will take a few minutes but don’t close the tab until the process is completed.
After its completion, you will see the download option for installer and archive package as well. The archive package is basically a clone of your WordPress website, including images, themes, plugins, uploads, and backup as well. Whereas, the installer is a script that automates the transfer when the archive file is opened. These both are quite an important file! Just click on the ‘one-click download’ link to download both files.
Step 2- How to Create a Database?
In order to migrate WordPress from localhost to server, it’s very important to create a MySQL database, which is a freely available open-source Relational Database Management System. If you already have one then you are good to go! If you are creating one then follow these steps:
Now, cPanel will create a new database. Now, scroll down to the MySQL user’s section. Now add a confidential username and password to create a new user. Now, when the new user is created you must permit to work on the database. For that go to the ‘‘Add User to Database’ section. Next step is to select the database user from the dropdown menu which is right next to the ‘User’ button, then click on the database and then the add button.
Now, the user can work on the WordPress site, here one thing you need to make sure that you have saved the details of the database name, username, and password on your Notepad; as it is required to complete the whole process.
Step 3- How To Upload Files From Localhost To Live Server?
Next, is a very important step, so carefully read it out, in this step you need to upload the archive and installer files from your localhost to live server. It starts with connecting your live server with the help of an FTP client. The FTP client is a software designed to transfer the files both ways between a computer and an online server.
When you are done with this step, next you need to be sure that the root directory of your website does not have any files and is empty. Now, you are ready to upload the archive and installer files from Duplicator to your root directory.
Step 4- How To Run The Migration Script?
The last step in transferring WordPress site from localhost to server is to run the migration script. When you have successfully uploaded the migration files, now you need to open http://yourdomainname.com/installer.php. Here yourdomainname is the domain name of your website. Now, the Duplicator migration wizard will open on your screen.
Now, the installer will run a validation test and will scan for the archive files. You just need to check out the terms and conditions, click the right button and then click the Next button. A screen will appear in which you need to enter the information of your WordPress database; in which host is the localhost. Now, you need to enter the database details, which you have created earlier. Now click the Next button. Here, your WordPress database backup from the archive will be imported into a new database. The next step is to update your site URL, and click the next button.
Now you are successfully done with the whole process, and a success screen will appear. Just click the ‘Admin Login’ button and you can enter the admin area of your website. Now, Duplicator will assist you in cleaning up all installation files automatically.
Congratulations! You are done with the process of migrating WordPress from localhost to server.
If you follow these steps carefully, there is a rare chance that you may get stuck in between. Still, there are a few common errors which techies face while carrying out the process of transferring WordPress site from localhost to server. So let’s discuss them!
Issues While Exporting and Importing your WordPress Database
In some cases, you may fail to export or import all of the contents and only a part of it may get exported/imported. So what can you do in this case?
You need to directly go to the database and export your SQL file, but sometimes, a few errors occur in this step as well. So here is the solution, with the access to your database through phpMyAdmin, you can export the SQL data. In case you don’t have access you can install WordPress plugin Adminer.
Another easy way is to export the data through MySQL commands, for this you need to have SSH access to your servers and use mysqldump command. So here are the commands you need to follow:
Issues While Uploading/Downloading Files
It is important a have a good internet connection, so the process may not take ages to complete. Making a compressed file before uploading is also recommended to make the process faster. While you are transferring files from one server to another you may use LFTP and mirror commands
Getting The Right Size Of Your Thumbnails
In case you are redesigning your theme or picking up a new one, the size of your featured image may also change and look distorted. In that case, just download the “Regenerate Thumbnails” plugin and activate it. Then go to Tools and click regen and then click Regenerate All Thumbnails.
Configuration of WordPress After Migration
The new database has reference to the old site as well. In case, the domain name is changed in migration, you face various redirection problems. For this, you need to update on WordPress about your new site domain.
Go to Settings-General
To fix this problem, search wp-config.php file (or add them to the end of that file) and put there your correct URL:
Having Problems With File Permissions
While you are migrating WordPress from localhost to server, you may face permission issues. Some hosts servers allow you to work on files with the permissions like 777 which provides access to read and write the files. This is not good from the security point of view. For this, the easiest solution is to have SSH access to your server, and you can change the permissions of files by using the command:
chmod -R 644 /path/to/folder/
Taking Help Of Professionals
After following all the steps carefully, if you are still unable to fix the issues, it is recommended to take the help of some experts. Obviously, you don’t want to waste your time and energy on fixing the particular issue. It’s better to spend some pennies and get your problems fixed. There are various WordPress agencies which you can also hire to make your work easy.
It’s very important to work with full concentration at each and every step otherwise you will land yourself in trouble.
So, these were some basic errors which may occur while you are transferring WordPress site from localhost to server. If you are properly following the given process of moving WordPress site from localhost to server, you may face least errors and issues.
Hope you get answers to all your queries which may occur while carrying out the process of migrating WordPress site from localhost to server!