Skip to the content.

WordPress Multisite Installation Guide

What is WordPress Multisite?

WordPress Multisite is a powerful feature that allows you to run and manage multiple WordPress websites from a single WordPress installation. With Multisite, you can create new sites instantly and manage them using the same username and password.

Advantages of Using WordPress Multisite

  1. Manage multiple sites from a single dashboard as the network administrator
  2. Each site can have its own admin users who can only manage their respective websites
  3. Install plugins/themes and activate them for multiple sites with one download
  4. Easier update management - you only need to update WordPress, plugins, or themes on one “master” installation

Disadvantages of Using WordPress Multisite

  1. All sites share the same resources - if the network goes down, all sites go down
  2. Traffic and server resource management can be challenging for beginners
  3. Security vulnerabilities - if one site gets hacked, all sites on the network may be affected
  4. Some WordPress plugins may not work properly on a multisite network
  5. Not all hosting providers adequately support WordPress multisite

WordPress Multisite Installation Steps

1. Requirements

2. Enable Multisite Feature

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
sed -i "/\/* That's all, stop editing! Happy publishing. \*\//i \
\/* Multisite *\/\ndefine( 'WP_ALLOW_MULTISITE', true );\n" /path/to/wordpress/wp-config.php

3. Complete Multisite Network Setup

  1. Log in to your WordPress admin panel
  2. Go to Tools > Network Setup
  3. Choose your network structure:
    • Subdomains: site1.example.com
    • Subdirectories: example.com/site1/
  4. Enter a title for your network
  5. Verify your admin email address
  6. Click the “Install” button

4. Update Configuration Files

After completing the Network Setup, WordPress will provide you with code snippets to add to your wp-config.php and .htaccess files.

For wp-config.php

Add the provided code to your wp-config.php file after the line you added in step 2.

For Subdirectory Installation:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // false for subdirectories
define('DOMAIN_CURRENT_SITE', 'example.com'); // Change to your domain
define('PATH_CURRENT_SITE', '/'); // Change if WordPress is in a subdirectory
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('COOKIE_DOMAIN', false); // Recommended for local development

For Subdomain Installation:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true); // true for subdomains
define('DOMAIN_CURRENT_SITE', 'example.com'); // Change to your domain
define('PATH_CURRENT_SITE', '/'); // Change if WordPress is in a subdirectory
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('COOKIE_DOMAIN', false); // Recommended for local development

For Subdirectory Installation:

sed -i "/\/\* That's all, stop editing! Happy publishing. \*\//i \
\/\* Multisite \*\/\ndefine('WP_ALLOW_MULTISITE', true);\n\n\/\* Multisite Network Configuration \*\/\ndefine('MULTISITE', true);\ndefine('SUBDOMAIN_INSTALL', false);\ndefine('DOMAIN_CURRENT_SITE', 'example.com');\ndefine('PATH_CURRENT_SITE', '\/');\ndefine('SITE_ID_CURRENT_SITE', 1);\ndefine('BLOG_ID_CURRENT_SITE', 1);\ndefine('COOKIE_DOMAIN', false);\n" /path/to/wordpress/wp-config.php

For Subdomain Installation:

sed -i "/\/\* That's all, stop editing! Happy publishing. \*\//i \
\/\* Multisite \*\/\ndefine('WP_ALLOW_MULTISITE', true);\n\n\/\* Multisite Network Configuration \*\/\ndefine('MULTISITE', true);\ndefine('SUBDOMAIN_INSTALL', true);\ndefine('DOMAIN_CURRENT_SITE', 'example.com');\ndefine('PATH_CURRENT_SITE', '\/');\ndefine('SITE_ID_CURRENT_SITE', 1);\ndefine('BLOG_ID_CURRENT_SITE', 1);\ndefine('COOKIE_DOMAIN', false);\n" /path/to/wordpress/wp-config.php

For .htaccess

For Subdirectory Installation:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

For Subdomain Installation:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

For Subdirectory Installation:

sudo bash -c 'cat > /path/to/wordpress/.htaccess << "EOL"
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
EOL'

For Subdomain Installation:

sudo bash -c 'cat > /path/to/wordpress/.htaccess << "EOL"
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
EOL'

WordPress Alt Dizinde Kuruluysa:

Eğer WordPress bir alt dizinde kuruluysa (örneğin, /blog/ veya /wordpress/), .htaccess dosyasındaki RewriteBase değerini buna göre ayarlamanız gerekir:

RewriteBase /wordpress/

5. Log Back In

After updating the configuration files, log out and log back in to your WordPress admin panel.

6. Network Administration

  1. After logging back in, you’ll see a new “My Sites” menu in the admin toolbar
  2. Go to My Sites > Network Admin to access the network dashboard
  3. From here, you can manage network settings, add new sites, and configure themes and plugins

7. Adding New Sites

  1. Go to My Sites > Network Admin > Sites
  2. Click the “Add New” button
  3. Enter the site address, title, and admin email
  4. Click “Add Site”

8. Managing Themes and Plugins

  1. Go to My Sites > Network Admin > Themes or Plugins
  2. Install themes or plugins as you normally would
  3. Use the “Network Enable” option to make themes or plugins available to all sites

Setting Up Wildcard Subdomains (For Subdomain Installation)

If you chose the subdomain option, you’ll need to set up wildcard subdomains on your server:

For Apache

  1. Make sure the Apache module mod_rewrite is enabled:
sudo a2enmod rewrite
sudo systemctl restart apache2
  1. Configure your virtual host to allow wildcard subdomains:
<VirtualHost *:80>
    ServerName example.com
    ServerAlias *.example.com
    DocumentRoot /var/www/html/wordpress

    <Directory /var/www/html/wordpress>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

For Local Development

  1. For local development, you’ll need to modify your hosts file:
# On Linux/Mac
sudo nano /etc/hosts

# Add these lines
127.0.0.1   example.test
127.0.0.1   site1.example.test
127.0.0.1   site2.example.test
  1. Or use a tool like dnsmasq to handle wildcard subdomains automatically:
# Install dnsmasq
sudo apt-get install dnsmasq

# Configure dnsmasq
sudo nano /etc/dnsmasq.conf

# Add this line
address=/.example.test/127.0.0.1

# Restart dnsmasq
sudo systemctl restart dnsmasq

Using Custom Domains for Each Site

WordPress multisite also allows you to set different domains for each website in your network using domain mapping:

  1. Install a domain mapping plugin like “WordPress MU Domain Mapping”
  2. Add the necessary DNS records for each domain to point to your server
  3. Map domains to specific sites in your network through the plugin settings

Troubleshooting

Common Issues and Solutions

404 Errors on Subsite Pages

sudo a2enmod rewrite
sudo systemctl restart apache2

Redirect Loop or Improper Redirects

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

Network Admin Not Accessible

Permission Issues

find /path/to/wordpress -type f -exec chmod 644 {} \;
find /path/to/wordpress -type d -exec chmod 755 {} \;
chmod 600 /path/to/wordpress/wp-config.php

Local Development Considerations

When developing a WordPress Multisite locally:

  1. Use a local development environment like XAMPP, MAMP, Local by Flywheel, or Docker
  2. For subdirectory installations, no special configuration is needed
  3. For subdomain installations, you’ll need to configure your hosts file or use a tool that supports wildcard subdomains
  4. Consider using a .local or .test TLD for local development
  5. Set COOKIE_DOMAIN to false in your wp-config.php file to avoid cookie issues

NOTE: You can use the wp.multisite.sh script to automate the WordPress Multisite setup process. This script will automatically convert your WordPress installation to a multisite configuration.