How to Copy a Multi-Site Website to WP Local

Backing up, migrating or copying a multi-site WordPress website from WP Engine or from any live server to a local environment can be a bit tricky, especially when using tools like WP Local, which do not directly support importing multi-site installations. Follow this guide to successfully migrate your multi-site setup for local development or testing.

Step 1: Set Up a Fresh WordPress Multisite on WP Local

To begin, it’s important to note that WP Local does not directly support importing multi-site setups. Therefore, you need to create a fresh WordPress installation configured as a multisite. This provides a blank slate where you can later import your database and files from WP Engine.

  1. Create a Fresh WordPress Installation:
    • Open WP Local.
    • Click the + icon to create a new site.
    • Enter your desired site name.
    • Choose your preferred environment settings (default settings typically work well).
    • Set up your WordPress username and password.
    • Click on Advanced Options and select WordPress Multisite.
    • Click Add Site to create the multisite setup.
  2. Set Up MySQL:
    • After the site is created, set up MySQL as needed for your local environment.

Step 2: Export the Database from WP Engine

Before importing your site’s database into the local environment, you need to export it from WP Engine. This involves accessing the phpMyAdmin tool and exporting the entire database as a .sql file.

  1. Access phpMyAdmin on WP Engine:
    • Log in to your WP Engine account and navigate to the website you want to back up.
    • Locate and access phpMyAdmin on the site page.
  2. Export the Database:
    • In phpMyAdmin, navigate to the Export tab.
    • Select the option to export the entire database.
    • Save the exported .sql file to your computer. This file contains all the database information that will be imported into your local environment.

Step 3: Import the Database into WP Local

With your fresh multisite setup ready and the database exported, the next step is to import the database into WP Local. This involves using WP Local’s Site Shell to run database import commands.

  1. Open Site Shell in WP Local:
    • Return to WP Local and open the site you created.
    • Click on Site Shell to open the command-line interface for your site.
  2. Copy the Exported SQL File to the Local Directory:
    • Copy the exported .sql file to the app/public directory of your WP Local site. This makes the file accessible for import.
  3. Import the Database:
    • In the Site Shell, use the following command to import the database:
    • wp db import your_exported_sql.sql
    • Replace your_exported_sql.sql with the name of your exported SQL file.
    • Wait for the import process to complete. This command restores the database on your local multisite setup.

Step 4: Update Domain URLs Using Search and Replace Tool

After importing the database, the domain URLs still point to the live site on WP Engine. You need to replace these with your local environment URLs. This is achieved using a search and replace tool combined with SQL commands in WP Local’s database management interface.

  1. Open the WP Local Database:
    • In WP Local, navigate to Database and click Open AdminerEvo.
    • Select the database associated with your local site.
  2. Run the Search and Replace Command:
  3. Replace Domain URLs:
    • Enter your original domain (e.g., codefaq.org) and your new local domain (e.g., codefaq.local) into the tool.
    • Ensure to replace any instances of the domain with “www” as well (e.g., www.codefaq.org to codefaq.local).
    • Copy the generated SQL commands and execute them in the SQL Command section in AdminerEvo. This will update all URLs to match your local setup.

Step 5: Copy the wp-content Directory to WP Local

The final step involves copying the wp-content directory, which contains your themes, plugins, and uploads. This step ensures your local environment matches the live site’s functionality and design.

  1. Copy the Entire wp-content Directory:
    • On your WP Engine website, access the file system and download the entire wp-content directory.
  2. Paste into WP Local:
    • Copy the downloaded wp-content directory to the corresponding wp-content directory in your WP Local site’s folder.
  3. Verify Your Local Setup:
    • Once the wp-content folder is copied, your local multi-site setup should be fully functional. Check that everything runs smoothly and that all links and functionalities work as expected.

Leave a Comment

trabzon escort yalova escort Samsun escort izmit escort nazilli escort