user

Mohamed Atef

20 Apr 2021

How to migrate Wordpress website from localhost to live site ?

Wordpress

Moving Wordpress from Localhost to Live site in easy two ways 

Migrating a Wordpress website from localhost to live hosting or server or another site is a necessary step every developer or designer should learn about it, remember when I was a Junior I thought that Migrating the site from My localhost to the live server is something Hard to do, but after getting an experience in Wordpress I realized that Migrating your website is something easy and it's one of the most things which you should know because it's an important step to learn and make sure that you will need to do it a lot 

1- Migrating Wordpress using a plugin 

After testing and using a lot of Plugins I can tell you that “ All in one WP migration ” is almost the best plugin to move your Website from a server or localhost to another live server this in the case of a Small website (less than 512MB), if your site is more than 512MB you gonna need to buy an add-on or you will have to use the second Way, if you asked me about the Add-ons for All in one WP migration I will tell you that I see it's unaffordable it's around 100$ but you can do a lot of other useful things using the 100$ 

How to use All in one WP migration?

First thing first you need to install Wordpress on the domain or the server which you want, then you need to install the plugin on Both sites (the one which you want to migrate & the new site which is empty Wordpress installation or Existing Wordpress site)
After installing & activating the plugin like the screenshot below click on Export 

When you get into the Export page, click on export & choose File from the drop-down 

It's gonna load for a while and it's gonna be longer if the site is bigger, then will show you Download SITENAME like the screenshots below 

Now you will need to import the plugin from your device on the site which exists on the server or the domain which you want,

How to Import the site using All in one WP migration?

In the beginning, you need to install the plugin as I said at the top, 
then from the sidebar menu click on import instead of export and gonna see the screen like the image below, Click on import from & choose file & then choose the file which you get from the Export step which its extension is .WPRESS  

It will start Uploading the file, and when it's done, it will ask you for your confirmation like the screenshot below

Note that when you click on Proceed all the files & database of site will be gone & will be replaced with the files of the site which you exported & you will login using the same username & password of the exported site 

When the importing is done successfully you will see this message

2- How to migrate Wordpress manually?

In migrating Wordpress Manually the idea is that you copy the database & copy the files and upload them to the FTP & PHPMyAdmin & then you gonna need to update the Domain & the URLs to the new domain which you got, but in updating the URLs it's gonna take two steps to get this done as I am gonna do in the steps below 

The steps are 

  1. Compress the files of the site from your device
  2. Upload the compressed file to the directory of the new site using FTP or the file manager
  3. Now go to PHPMyAdmin in your device (Localhost) then export the Database
  4. Import the database in the PHPMyAdmin of the server
  5. Update the Site URL to the correct domain
  6. Update all links of the site using Better search replace

1- Compress the files of the site from your device

2- Upload the compressed file to the server & update wp-config.php

Here I am going to use File Manager from Cpanel 

Then uncompress the file & you gonna need to update the wp-config.php file to avoid the “Establishing a Database Connection”, you will need to update the Database name & Username & password of the user which has Privileges to the database (SQL user) like the screenshot below 

3- Export the database from the Localhost

from your PHPMyAdmin open the database that belongs to your website them click on Export, then click go & after getting the database_name.sql file you need to compress it into ZIP and rename it to be database_name.sql in ZIP format, Now your database is ready to be imported 

4- Import the database from the PHPMyAdmin on the server 

After few minutes of loading you will see the success message 

Note: If you got an unfamiliar error while the importing process please make sure that you are using a similar SQL version

Now you need to update the website link from wp_options, double click on these two columns and add correct domain name instead of the localhost link 

Now you have to install Better search replaceplugin to update the links & the broken assets 

then you have to search for the localhost link & update it with the new domain name like the image below

then click on Run Search 

That's all, if you have any questions let me know in the comments below  

Comments

Hesham Karin

21 Apr 2021

thank you Mohamed it was so easy and very important

© 2024 Copyrights reserved for web-brackets.com