Multisite
-
Snapshot your database so you can revert if needed:
ddev snapshot -
Uncomment the following line in your
.envfile:.env # Multisite optionsALLOW_MULTISITE=true# MULTISITE=true# DOMAIN_CURRENT_SITE=# SUBDOMAIN_INSTALL=false# PATH_CURRENT_SITE='/'# SITE_ID_CURRENT_SITE=1# BLOG_ID_CURRENT_SITE=1 -
Install the following plugin using Composer
ddev composer require roots/multisite-url-fixer -
Go to the WordPress admin.
-
Disable all active plugins.
-
Go to Tools > Network Setup.
-
Pick the right settings and click on
Install -
Update your
.envfile with the values shown on the WordPress admin screen:.env # Multisite optionsALLOW_MULTISITE=trueMULTISITE=trueDOMAIN_CURRENT_SITE=your-project-name# SUBDOMAIN_INSTALL=false# PATH_CURRENT_SITE='/'# SITE_ID_CURRENT_SITE=1# BLOG_ID_CURRENT_SITE=1Replace your-project-name with the value shown on the WordPress admin screen
-
Update your htaccess file with the value shown on the WordPress admin screen.
web/.htaccess # BEGIN WordPress Multisite# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisiteRewriteEngine OnRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]RewriteBase /RewriteRule ^index\.php$ - [L]# add a trailing slash to /wp-adminRewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]RewriteCond %{REQUEST_FILENAME} -f [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^ - [L]RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]RewriteRule . index.php [L]# END WordPress Multisite -
Refresh the wp-admin tab and log back in.
-
Re-enable your plugins.
Known Errors
Section titled “Known Errors”Adding a new sub site throws an error when trying to visit the theme
Head over to web/app/mu-plugins/whoops-error-handler.php and comment out the following line
<?php
/*** Plugin name: Whoops Error Handler*/
// This checks necessary if you use the package as a dev dependencyif (!class_exists(Renakdup\WhoopsErrorHandler\ErrorHandler::class)) { return;}
$error_handler = new Renakdup\WhoopsErrorHandler\ErrorHandler('default-original'); $error_handler->init(); // $error_handler->init();Refresh the page — it should work now. Once confirmed, re-enable the plugin:
<?php
/*** Plugin name: Whoops Error Handler*/
// This checks necessary if you use the package as a dev dependencyif (!class_exists(Renakdup\WhoopsErrorHandler\ErrorHandler::class)) { return;}
$error_handler = new Renakdup\WhoopsErrorHandler\ErrorHandler('default-original');
// $error_handler->init(); $error_handler->init();
