Skip to Content
Documentation
Product Dev
AgentImage Bedrock
Workflows
Setting up a Wordpress multi-site (MU)

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.

terminal
git clone [email protected]:training/training-ap-panorama.git

Create a Branch.

🚫
Important

Follow Naming Guidelines.

terminal
git checkout -b 'Branch_Name'

Enable Multisite

  1. Open config/application.php in your Bedrock project.
  2. After the DB configuration lines, add:
    application.php
    Config::define('WP_ALLOW_MULTISITE', true);
  3. Save the file.

Access Network Setup

  1. Log in to your WordPress admin dashboard.
  2. 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.

Configure the Network

  1. Choose between Subdomains or Subdirectories.
    • Subdomains: site1.example.com (wildcard DNS required).
    • Subdirectories: example.com/site1
  2. Click “Install”.

Update Configuration

WordPress will display code snippets. You must:

  1. Copy the generated constants (e.g., MULTISITE, SUBDOMAIN_INSTALL, etc.).

  2. Paste them into config/application.php (after the DB settings).
    Example:

    application.php
    Config::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.php
    Config::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:
    Update web/.htaccess with the rules provided by WordPress after enabling multisite.
    Example rules for subdirectory multisite:

    .htaccess
    RewriteEngine 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.config
    server { 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 Bedrock web directory.
    • Update fastcgi_pass to your PHP-FPM socket or address.

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:

terminal
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.

terminal
git add .

Commit the changes you’ve made.

terminal
git commit -m '<commit_message>'

Push your changes.

terminal
git push origin 'Branch_Name'

Create Merge Request.

terminal
https://gitlab.forge99.com/your_project_group/your_project_url

Step 8: Finalize

  1. Log in again if prompted.
  2. You should now see a “My Sites” menu in the admin bar.
  3. Add new sites from the Network Admin dashboard.

Troubleshooting

  • Network Setup not visible:
    Ensure Config::define('WP_ALLOW_MULTISITE', true); is in config/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).

References

Last updated on