Skip to content

Local development with Multisite

Pull a WordPress network to your computer with DDEV. Subdirectory networks open at / and /es/ on your project address, subdomain networks open each site on its own local name, and your table prefix is kept.

Parts of this feature are still being built. The Not yet section lists them.

The Avaloi add-on for DDEV works with a WordPress Multisite network and with any table prefix. Set it up as in Develop locally with DDEV. This article covers what changes for a network.

Your table prefix

The add-on asks Avaloi for the prefix of the environment and writes it into the local wp-config.php. It also reads the real prefix from the server or from the database dump, and it uses that one if the two differ. It never assumes wp_. Search and replace runs on every table that starts with your prefix.

A subdirectory network

A network where the English site is at / and the Spanish site is at /es/ opens the same way on your computer:

  • https://your-project.ddev.site/ is the main site.
  • https://your-project.ddev.site/es/ is the Spanish site.
  • https://your-project.ddev.site/es/wp-admin/ is its dashboard.
  • Uploads of the Spanish site are in wp-content/uploads/sites/2/.

The add-on rewrites the network address, every site, and the settings in wp-config.php to your local address. It also adds the web server rules a subdirectory network needs.

A subdomain network

DDEV can serve every name under your project address. The add-on turns on a wildcard name for your project, and DDEV makes the certificate. A site that ran at es.example.com opens at https://es.your-project.ddev.site/.

This needs the ddev.site name to resolve on your computer. If it does not, DDEV tells you how to add the names to your hosts file.

The address map

The add-on writes .ddev/avaloi-network.json. It lists each site with its Avaloi address and its local address. It holds no secret. Every database pull rebuilds it from what Avaloi reports. Do not edit it.

Push to staging

You can push your local database to staging or a multidev, never to live. For a network the add-on first turns every local address back into the address of that environment, one site at a time. It does this on a copy, so your local database stays as it is.

The push stops, with a plain message and before anything is uploaded, when the map is not safe to reverse:

  • the map is missing or older than the network (a site exists in only one place);
  • two sites would get the same address;
  • you created a new site on your computer, because Avaloi cannot know where it belongs. Create it in the Network Admin of the environment, then pull again.

Check your setup

Run ddev avaloi doctor. It shows the prefix, the network type, the state of the map, and the local names.

Not yet

  • A subdomain network on a computer without working ddev.site name resolution needs a hosts file change.
  • Posts created on your computer keep the local address in their guid after a push.
  • Pushing a new local site to a network is not supported.

Still stuck?

Email [email protected] with your site name and what you tried, or send us a message.