
Have you ever wanted to manage multiple WordPress websites from a single installation? I’ve been there, and I’m going to show you exactly how to set up WordPress multisite with root domains. This powerful setup lets you run as many separate websites as you need—all from one WordPress core installation and one database. Trust me, it’s a game-changer for multi-site management.
What is WordPress Multisite?
WordPress multisite is a remarkable feature that transforms a standard WordPress installation into a network of sites. While WordPress officially supports subdomain and subfolder multisite configurations, this guide focuses on using completely separate root domains—something many don’t realize is possible!
For example, you can have example1.com, example2.org, and example3.net all running from the same WordPress installation. Each site looks and functions independently, but behind the scenes, you’re saving tremendous time and resources.
Why You Should Use WordPress Multisite with Root Domains
I’ve managed dozens of WordPress sites over the years, and multisite has completely transformed my workflow. Here’s why you’ll love this approach:
1. Centralized Management is a Game-Changer
Managing multiple WordPress sites separately is a nightmare. With multisite, you’ll:
- Update WordPress core just once for all your sites
- Install and update wordpress plugins in one place
- Manage themes across all sites from a single dashboard
- Handle user permissions centrally
This saves hours of repetitive maintenance every week!
2. Hosting Efficiency
Many hosting providers charge per installation or have limitations on lower-tier plans. Multisite lets you:
- Host unlimited domains on a single hosting account
- Bypass directory restrictions common on shared hosting
- Maximize your hosting investment without upgrading packages
3. Database Economy
Database limitations can be frustrating. Multisite solves this by:
- Using a single database for all your sites
- Reducing database connection overhead
- Cutting hosting costs associated with multiple databases
- Simplifying backup and restoration processes
4. Content Sharing Made Easy
When your sites live under one roof, you can:
- Share media libraries between sites (with the right plugins)
- Reuse content across sites without duplication
- Create consistent branding across your network
How to Set Up WordPress Multisite with Root Domains
Let’s get your multisite network running with separate root domains. I’ll walk you through each step of this process.
Step 1: Install Your First WordPress Site
Start with a standard WordPress installation for your first site. There’s nothing special required at this stage, but I strongly recommend using a custom database prefix instead of the default “wp_” for better organization and security.
For example, if your first site is “techblog.com”, use something like “tech_” as your database prefix.
// Example database configuration with custom prefix
define('DB_NAME', 'your_database');
define('DB_USER', 'your_username');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
$table_prefix = 'tech_';
Code language: PHP (php)
Step 2: Configure Your Domain DNS
Before proceeding, make sure all your domains point to the same hosting directory. This typically involves:
- Setting up DNS A records for each domain to point to your server IP
- Configuring your hosting to recognize all domains (through cPanel, Plesk, or similar)
- Setting up domain aliases or add-on domains in your hosting panel
Step 3: Prepare for Secondary Installations
Now comes the clever part. Follow these steps carefully for each additional site:
3.1 Back Up wp-config.php
First, create a backup of your wp-config.php file. This is absolutely critical—skip this, and you risk breaking your existing site.
# SSH command example to back up your config
cp wp-config.php wp-config.php.backup
Code language: CSS (css)
3.2 Temporarily Remove wp-config.php
Next, remove the wp-config.php file from your server. This tricks WordPress into thinking this is a fresh installation when you visit your second domain.
Important Warning: Your first site will be temporarily unavailable during this step! Schedule this during low-traffic hours.
3.3 Run the Installation Process
Now, access your second domain in your browser. WordPress will present you with the installation screen since it can’t find a configuration file.
Complete the installation process as you normally would, but pay special attention to the database prefix. Use a unique prefix that reflects this domain—if your second site is “petstore.com”, you might use “pets_” as the prefix.
Step 4: The Magic Happens in wp-config.php
Once you’ve completed the installation for your second site, it’s time to modify the wp-config.php file to dynamically change the database prefix based on the domain being accessed.
Replace your wp-config.php with this improved version:
// Standard WordPress database configuration
define('DB_NAME', 'your_database');
define('DB_USER', 'your_username');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
// Dynamic table prefix based on domain
if($_SERVER['HTTP_HOST'] == 'techblog.com' || $_SERVER['HTTP_HOST'] == 'www.techblog.com') {
$table_prefix = 'tech_';
}
else if($_SERVER['HTTP_HOST'] == 'petstore.com' || $_SERVER['HTTP_HOST'] == 'www.petstore.com') {
$table_prefix = 'pets_';
}
// Add additional domains as needed
else if($_SERVER['HTTP_HOST'] == 'yourthirddomain.net' || $_SERVER['HTTP_HOST'] == 'www.yourthirddomain.net') {
$table_prefix = 'third_';
}
// Default prefix as fallback
else {
$table_prefix = 'wp_';
}
Code language: PHP (php)
Step 5: Enhance Your Setup (Recommended)
For a more robust setup, I recommend these additional configurations:
5.1 Add Shared Constants
Most configuration constants can be shared across all sites. Keep these in the main section of wp-config.php:
// Security keys (get unique keys from https://api.wordpress.org/secret-key/1.1/salt/)
define('AUTH_KEY', 'your-unique-key');
define('SECURE_AUTH_KEY', 'your-unique-key');
define('LOGGED_IN_KEY', 'your-unique-key');
define('NONCE_KEY', 'your-unique-key');
define('AUTH_SALT', 'your-unique-key');
define('SECURE_AUTH_SALT', 'your-unique-key');
define('LOGGED_IN_SALT', 'your-unique-key');
define('NONCE_SALT', 'your-unique-key');
// Debug settings (turn off for production)
define('WP_DEBUG', false);
Code language: JavaScript (javascript)
5.2 Domain-Specific Settings (Optional)
You can also add domain-specific configuration settings:
// Domain-specific settings
if($_SERVER['HTTP_HOST'] == 'techblog.com' || $_SERVER['HTTP_HOST'] == 'www.techblog.com') {
define('WP_DEBUG', true); // Enable debugging only on this site
}
Code language: PHP (php)
Common Issues and Troubleshooting
Even with careful setup, you might encounter some challenges. Here’s how to solve the most common issues:
1. White Screen of Death
If you get a blank white screen after installation:
- Check your database credentials
- Verify table prefixes are correct
- Look for PHP errors in your server logs
2. Login Session Problems
If you’re having trouble staying logged in:
- Make sure each domain has its own unique prefix
- Check that your wp-config.php correctly identifies all domains
- Consider domain-specific cookie settings
3. Plugin Conflicts
Not all plugins play nicely with multisite. If you encounter issues:
- Test problematic plugins on a single site first
- Look for multisite-compatible alternatives
- Contact plugin developers for multisite support
Advanced Tips for WordPress Multisite
Want to take your multisite setup to the next level? Try these advanced techniques:
Use a Centralized Plugin Management Solution
Consider using ManageWP, MainWP, or InfiniteWP to manage all your sites from a single dashboard. These tools complement your multisite setup perfectly.
Implement Domain Mapping
For a more elegant setup, explore domain mapping plugins that work with root domains. This creates a more structured relationship between your sites.
Optimize Database Performance
As your multisite network grows, database performance becomes crucial. Consider:
- Adding database caching
- Optimizing database tables regularly
- Using a database cleanup plugin to remove unnecessary data
Conclusion
WordPress multisite with root domains gives you the best of both worlds—the efficiency of unified management with the flexibility of separate websites. I’ve been using this setup for years to manage multiple client sites, and it’s saved countless hours of maintenance time.
While the official WordPress documentation doesn’t focus much on this approach, it’s completely viable and offers tremendous advantages for developers and site managers who need to handle multiple independent websites.
Have you tried setting up WordPress multisite with root domains? What challenges did you face? Share your experience in the comments below!
Discover more from CodeSamplez.com
Subscribe to get the latest posts sent to your email.
Leave a Reply