Bedrock WordPress Multisite Setup Documentation
This guide explains how to set up a WordPress Multisite Network using Bedrock.
Prerequisites
- Bedrock already installed and running.
- Web server (Apache or Nginx) and database (MySQL).
- Admin access to your WordPress installation.
Given that you have not cloned the existing repository yet.
git clone [email protected]:training/training-ap-panorama.git
Create a Branch.
Follow Naming Guidelines.
git checkout -b 'Branch_Name'
Enable Multisite
- Open
config/application.php
in your Bedrock project. - After the DB configuration lines, add:
application.php
Config::define('WP_ALLOW_MULTISITE', true);
- Save the file.
Access Network Setup
- Log in to your WordPress admin dashboard.
- Go to
Tools > Network Setup
.- If you do not see this option, double-check that you have added the
WP_ALLOW_MULTISITE
line and you are logged in as an admin.
- If you do not see this option, double-check that you have added the
Configure the Network
- Choose between Subdomains or Subdirectories.
- Subdomains:
site1.example.com
(wildcard DNS required). - Subdirectories:
example.com/site1
- Subdomains:
- Click “Install”.
Update Configuration
WordPress will display code snippets. You must:
-
Copy the generated constants (e.g.,
MULTISITE
,SUBDOMAIN_INSTALL
, etc.). -
Paste them into
config/application.php
(after the DB settings).
Example:application.phpConfig::define('MULTISITE', true); Config::define('SUBDOMAIN_INSTALL', true); // or false Config::define('DOMAIN_CURRENT_SITE', 'example.com'); Config::define('PATH_CURRENT_SITE', '/'); Config::define('SITE_ID_CURRENT_SITE', 1); Config::define('BLOG_ID_CURRENT_SITE', 1);
for subdirectory multisite, it would look like this:
application.phpConfig::define('WP_ALLOW_MULTISITE', true); Config::define('MULTISITE', true); Config::define('SUBDOMAIN_INSTALL', true); Config::define('DOMAIN_CURRENT_SITE', 'example.com'); Config::define('PATH_CURRENT_SITE', '/'); Config::define('SITE_ID_CURRENT_SITE', 1); Config::define('BLOG_ID_CURRENT_SITE', 1); Config::define('COOKIE_DOMAIN', ''); //
Update .htaccess or Nginx Configuration
-
If using Apache:
Updateweb/.htaccess
with the rules provided by WordPress after enabling multisite.
Example rules for subdirectory multisite:.htaccessRewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp/wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) web/$1 [L] RewriteRule ^(.*\.php)$ web/$1 [L] RewriteRule . index.php [L]
-
If using Nginx:
Update your server block as follows:nginx.configserver { listen 80; server_name example.com *.example.com; root /path/to/bedrock/web; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; # Adjust as needed fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } # Allow access to multisite files (like files uploaded to blogs.dir) location /files/ { try_files $uri /index.php?$args; } }
- Replace
/path/to/bedrock/web
with the actual absolute path to your Bedrockweb
directory. - Update
fastcgi_pass
to your PHP-FPM socket or address.
- Replace
Wildcard DNS (If Using Subdomains)
- Set up a wildcard DNS record for your domain (e.g.,
*.example.com
).
Install Multisite URL Fixer
Bedrock sites often run WordPress in a subdirectory (/web
). This can cause issues with multisite URLs.
Install the roots/multisite-url-fixer plugin to resolve this:
composer require roots/multisite-url-fixer
No additional configuration is required—just install and activate the plugin.
Once you are done editing the files, add or stage your changes.
git add .
Commit the changes you’ve made.
git commit -m '<commit_message>'
Push your changes.
git push origin 'Branch_Name'
Create Merge Request.
https://gitlab.forge99.com/your_project_group/your_project_url
Step 8: Finalize
- Log in again if prompted.
- You should now see a “My Sites” menu in the admin bar.
- Add new sites from the Network Admin dashboard.
Troubleshooting
- Network Setup not visible:
EnsureConfig::define('WP_ALLOW_MULTISITE', true);
is inconfig/application.php
and you’re logged in as an admin. - .htaccess/Nginx issues:
Ensure you copied the rewrite rules exactly as provided. - Subdomain issues:
Check your DNS and web server alias (e.g.,ServerAlias *.example.com
for Apache).