As a web developer, it is a very common practice to use a local server to test your site before it goes live.
Once you are ready to move your test site to a live domain, you can easily migrate it to your hosting server, connect it with a domain name and your website is live.
But in case you are working with a WordPress site on localhost, this process is a little bit more complicated than you think.
There are 2 different ways following which you can easily get it done.
The first method is the manual method and the second one is using a plugin.
If you wish to follow this process, it’s really important that you have good knowledge regarding your server, DB, DB access, and file management.
Once you are ready with the necessary hosting server, and domain you can get going right away.
You will need to export your local database. Visit your phpmyadmin panel, choose the database that you wish to export and click on export.
This will allow you to have a .sql file containing the whole WordPress Database related data.
To do so, choose to go with the “Quick” export and make sure to choose SQL as file type.
Once you click “GO”, you will have your Database as an SQL file.
The next step will be to upload all the local files to your live site. For this you can use a file transfer tool.
Make sure to get the necessary FTP credential from your server and you can copy all the local WordPress files to the live server.
Make sure to upload the files on public_html directory.
While your file transfer tool is uploading all your necessary files on the server, you can start creating your Database on the server.
You will have to upload your WordPress db on the live server, so this will require a Database on the server as well.
Make sure to use the same DB name as your local server to keep things easier to remember and set up. Once DB creation is complete, you will need to create a DB User as well.
Similarly like the DB name, make sure to create the same DB User for your live server as well.
Once done, add this to your WordPress DB and make sure to select all the privileges while assigning the DB User.
Once done, you can now import your local Database File to the live server DB.
For this you will need to go to phpmyadmin on your live server and select the DB that you wish to use.
Once done, click on the import option at the top right corner of the page; Upload your local .sql file and you are done.
Now you will need to change your live URL site in the database. Find the table that is named as “wp_options”.
Browse the database to find the siteurl. Now click on “edit” to change the url and you are done.
In case you have completely followed every step minutely, your live website URL should show “Error Establishing Database Connection”.
To fix this you will need to configure your WordPress site. Go to your File manager on your cpanel and find the file “wpconfig.php”.
Change the Dbname, Dbuser and Password to make sure it connects to the right database.
Once you are done with the necessary changes, save the file and reload your live URL.
Your WordPress site will load the way it shows up on your local server.
The last step will be to update your image paths and broken links.
For this you can use a plug-in or you can choose to go to phpmyadmin and make the necessary changes to the “wp_posts” table and you are done.
Using a Plugin
Although, for a developer, going through the above process is not an issue at all, but if you can use a plugin to transfer your local site to your live WordPress, then it can certainly save you a lot of time and you will be able to avoid a lot of unintentional errors as well.
There are actually different plugins available on WordPress to get this done.
You can choose any of them and get your job done and you will have your live site in no time at all.
All-In-One WP Migration plugin
Install this plugin on your local WordPress site and activate it.
Once done, go to “Export” option, and choose “File” as your LocalHost export file-type. Once done, click to download the “LocalHost” File.
On your live server, install WordPress. Install this plugin and click on “Import”.
Choose the “LocalHost” file from your PC and click on “Upload”.
Once done, upload your local Database file to the server using the same plugin and you are done.
Once the process is complete your will have your live website looking alike your local WordPress site.
Duplicator WordPress plugin
This is another of those free plugins that you can use to migrate your local WordPress site to your live server.
You will need to install this plugin on your local server first and activate it.
On your local Dashboard, you can find the plugin. Click on it and you can see an option “packages”.
Currently, it should be blank. Click on “Create New”;
Enter the package name, and the notes that you wish to add. You can also set up the installer and archive settings as well.
This will allow you to have an easy to use installer that you will use at a later phase.
Add all the necessary files and then click “Build”.
Now copy all the files created as archive and the install file to your public_html folder on live server.
When the installer asks for DB details enter a new info or the similar one to your local DB.
Once your database is up-to-date and is connected it will update your required data.
Once done, you will have your website live. Make sure to check the site properly before sharing or make it live to the public.
So, are you ready to migrate your local WordPress site to a live server?
Which one of these methods you think you can go with? Decide on your own and make your WordPress site live today!