Internet Marketing Agency | WordPress Websites & Online Marketing

Cloning Live Site to Local


Cloning Live Site to Local

This article provides a process (initially suggested by Santiago Garza) for cloning a production environment into a local environment, in my case from WPEngine to Local by Flywheel.

Get The Files

You need to actually have a copy of the site. This is usually received as a .zip file, though you only need the contents of /wp-content/*, and the sql dump (mysql.sql).

Under htts://<install>/backup_points#production, grab a copy of the site files. You can move onto the next step while this is being prepared in the background.

Preparing Your Install

Create the local install. 

Note: during/after this step, do not attempt to access the site, as it could result in the site breaking/having to redo certain steps.

Navigate to the sql side of your install, and go ahead and drop all tables (all of them). 

Delete all files under /wp-content/ in your new install.

Adding Data

Now, import the sql from your new site (mysql.sql). Note that the prefix for the tables must be the same as it is in your wpconfig file. This shouldn't happen often, but if it does, you can either change the table names, or the prefix in wpconfig.

Note: you may need to do a find replace for utf8mb4_unicode_520_ci -> utf8mb4_unicode_ci.

Copy all files from the zip/wp-content/ to the /wp-content/ of your install that you cleared. It's recommended to remove all /mu-plugins, as these are often important for live sites, but less so for local installs, and can actually cause problems. 

Now, ssh into the site, and use wp search-replace to replace the previous site url ( /(https|http):// -> https://install.local ).

You also may have to do a search-replace for along with http, depending on the site setup.

That should be it! Happy editing.

Possible Settings

I attached a screenshot of a possible fix, in case your local site cronjobs are not working.

There are a couple things you may also want to check.

For example, two major plugins we use are postmark and stripe. Both of these plugins will not differentiate between a development environment and a production environment, and subsequently it's very possible to send double emails out to clients, or worse double charges. Make sure you disable both of these, and any other settings.

Have more questions? Submit a request