Welcome to My Blog!

This is Boxer Template Demo Site
Follow Me

Clone WordPress Site To LocalHost – Clone WordPress Site Easily



By  Unknown     01:26     

Hoe To Clone WordPress Site To LocalHost – Clone WordPress Site Easily

There are applications like MAMP and WAMP used to create a local server environment and install WordPress so that developers and site owners can build their site in local PC or Mac and then move the backup to live server. But over the period of time your live site may have lot of deviations compared to the localhost site. At this point you may want to sync the live site’s content to local site so that you can test plugins / themes/ WordPress version updates on a local site before updating on a live site. Though there are plugins which can speedup the backup process, in this article we explain how to manually move live WordPress site to localhost environment.

This article explains the process of moving a live content to localhost. 


Move Live WordPress Site To Localhost

Before we go to the detailed process here is a summary of the entire process to indicate what are the things you might need to move your live site to localhost environment.

1. Use FTP client and download all your live WordPress site files, generally available under “/public_html” folder.
2. Login to your hosting account cPanel and export live site’s database from phpMyAdmin section.
3. Login to phpMyAdmin of your localhost using the application you used to install WordPress locally and create a new database.
4. Import live database file downloaded in step 2 to localhost server.
5. Run query to replace all occurrences of live site’s URL with the localhost URL.
6. Replace localhost site’s files with the live site’s files from step 1.
7. Edit “wp-config.php” file and change the database name to new database name as created in step 3.

8. View localhost site and login to localhost WordPress admin dashboard to see all live site’s content is available.

Step 1:– Download Live WordPress Site Files

Launch FTP client like FileZilla, connect to your hosting server and download all WordPress files of a live site to local computer. Generally files will be available under “/public_html” folder unless you changed it to another directory during WordPress installation. The entire download may take a while based on the size of your site. Hence we recommend to do this step first so that you can do further steps in parallel.

In FileZilla first choose local site’s location where you want save the files. Under remote site section, select the files and choose “Download” option by right clicking. This will download all selected files to your local computer.

Clone WordPress Site Easily

Step 2:– Exporting Live WordPress Site’s Database


The next step is to download the SQL database file of your live site. Login to your hosting account and go to the cPanel. Click on the phpMyAdmin icon and login to your phpMyAdmin section. Select the correct database and click on the “Export” option.

Clone WordPress Site Easily

1. Choose “Custom – display all possible options” as “Export Method”.
2. Select all database tables (you can ignore the tables which you don’t want to export by deselecting them).
3. Select output compression as “zipped” or “gzipped”.
4. Choose format as “SQL”.

Clone WordPress Site Easily

Click on “Go” button at the bottom to download the SQL database file in a compressed format to your local computer.

Step 3:– Creating A New Local Database

Similar to step 2, login to phpMyAdmin section of your localhost with the URL “http://localhost/phpmyadmin/” and create a new database with the same name as live site’s database.

Clone WordPress Site Easily

Step 4:– Importing Live Database To Local Site

Now select the newly created database and then click on the “Import” option. Choose the live site’s database downloaded in step 2 and upload to local server.

Clone WordPress Site Easily

Step 5:– Replace Live Site URL With Local Site URL In Tables


Now that you have uploaded live site’s database to local server but the tables will still have live site’s URL references instead of localhost which you need to change it. Copy the below query and replace the site name with your own URL.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.yoursitename.com', 'http://localhost') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.yoursitename.com', 'http://localhost');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.yoursitename.com','http://localhost');

Go to the phpMyAdmin section of your localhost site and select the database. Click on the “SQL” tab and paste the query in the box.

Clone WordPress Site Easily

Click on “Go” button to run the query to replace live site URL with localhost URL.


Step 6:– Replace Local Site Files With Live Site Files

Next step is to replace local site’s files with the live site’s files downloaded in step 1. The simple way to avoid mistakes here is to change the existing local folder name with the suffix “_old” and then create a new folder with the same name. Paste all live site’s files inside the new folder.

Clone WordPress Site Easily

Step 7:– Configuring Database Name In wp-config.php File


If you open your localhost site now it will probably show the message “Error establishing database connection”. Locate and open “wp-config.php” file in local server and replace the database name with the correct name as you created in step 3. Generally the username and password are same as “root” (unless you changed it) and change it accordingly.

Clone WordPress Site Easily

Step 8:– Check Your Localhost Site


Login to localhost WordPress admin dashboard and check all required plugins are activated. You need to check the plugins since some plugins can only work in a live environment. Open your localhost site and check that is now similar to live site.

I hope this article helped you on how to move your WordPress site to a new localhost. If you like this article please make sure to share it to your friends and if you still have any question please ask in comments.

About Unknown

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas euismod diam at commodo sagittis. Nam id molestie velit. Nunc id nisl tristique, dapibus tellus quis, dictum metus. Pellentesque id imperdiet est.

No comments:

Post a Comment


Contact Form

Name

Email *

Message *

Translate

Fashion