0

I create my websites on my PC using Xampp localhost. Then when I am ready, I upload to the server.

That all works fine. I have a particular site that has been up online for several years, and all new edits to the site have been done online.

Now, I want to get my local copy of the website to be exactly the same as the online one. (I need to do some local testing.)

What is the best way to get my local site synced up to the online one? I know how to download all the WP files, and I know how to backup the online database.

Is there an easy way to just update my current local copy (eg: found at 'http://localhost/LocalSite/LocalSiteWP' folder) with the new files and database?

Or is it better to just start with a new folder like eg: http://localhost/OnlineSiteCopy/OnlineSiteCopyWP, and just following instructions on how to create a local copy of your online site, including creating a new database, etc?

Can someone give me some direction on this - which is the better, faster route?.

0

In summary, work with Bedrock, use a git repository and use simple SQL batch to export/import your database between your different environments.

I work with WordPress since three years now and I tried a lot of stuff to do that with some plugins, some scripts, etc. I discovered last year a great boilerplate for WP called Bedrock. It changes the files structure to something more git-friendly and I now use it for all my WP projects. It comes with some great (or rather indispensable) options like brypt for passwords, composer and environment variables.

So basically, I personally use MAMP (but XAMPP is fine too) and use a directory that contains all my repositories. I just changed the Document Root each time I switch project. With Bedrock the only steps you need to do are

  1. Download SQL batch of your production (you can create a batch script to automatise that if you want
  2. Download your upload folder (contains all the medias and content submitted directly by the website)
  3. Update your .env with correct URL + SQL logins
  4. Change your Document Root on your local web server (MAMP or XAMPP)

You can use CI/CD to sync your production with your git repository automatically. In my agency we're using Buddy because it's very simple & fast to configure.

If you want another solution, I also tried Local WP to work locally but I still prefer the manual way as I mainly work on little projects with a little team.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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