I have a live network installed on a remote web server. I am about to start writing some plugins for it but want to test that they behave before disrupting a live site.

I was thinking that I would clone the site (backup the database, download via FTP the files) and restore to localhost for testing. The remote site uses subdomains for blogs.

What steps do I need to take so that my clone behaves pretty much as the remote version?

What changes do I need to make so that it can run as localhost instead of as a remote URL?

You'll have to set up a domain with wildcard subdomains in your localhost (I usually set up thelivedomain.local), direct that to 127.0.0.1 in your hosts file and run the DB search and replace tool against your local copy of the site to safely replace the live domain with your localhost domain in the WP database, because it stores URLs in serialized arrays which can break with a search&replace against the raw SQL.

You'd also have to make sure that your localhost's PHP version is the same and that you have the same PHP extensions enabled in your local environment as on the live server.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.