Move or Migrate wordpress site from Server to Localhost

There are many plugins available to migrate wordPress sites ,but you can do it manually.This article explains how to to migrate or move your live WordPress site to local server.

Follow the below steps for moving data from server to local.Before this ensure that an empty local WordPress site is installed in XAMPP.

  • Download WordPress Files from server

Download all you files from server either by FTP or File manager. Login to your hosting cPanel and select File Manager. Select the public_html folder, and choose Compress and download.

  • Export website database from server

Go to your hosting cPanel and locate phpMyAdmin . In Database Administration Dashboard select your database from the left hand side panel. Now select the “Export” option and choose a quick export option. The export file will be saved with .sql extension.

  • Modify the imported data

Open the .sql file in any notepad and replace the actual site name with localhost i.e ‘http://www.websitename.com’ –> ‘http://localhost’ .

Replace all the ‘INSERT INTO‘ statements with ‘INSERT IGNORE INTO‘ so as the migration should continue even if there are errors or duplicate data.

You can achieve the same post import with this query.
UPDATE wp_tablename SET column_name = replace(column_name,’http://www.websitename.com’,’http://localhost’);

  • Import the server database in to local

Go to you local Database admin dashboard and Import the sql file to local database..
The other way is to run each statements one by one on the local database.

  • Backup local configuration

Take a backup of wp-config.php file in local in C:\xampp\htdocs\localsite .

  • Replace server data on local site

All the files downloaded from public_html of server should be overridden on C:\xampp\htdocs\localsite . Restore the original wp-config.php file and restart the XAMPP server.Check the localhost links and paths. Login to Local wordpress site and activate the theme same as present in server.

  • Recreate post links

In case links to post are broken recreate .htaccess file by saving the Settings–>Permalinks Settings.

One comment

  1. How do I migrate my wordpress site from local to server ?

Leave a Reply