How to Setup WordPress Multisite with subdomains

WordPress Multisite with subdomains

This post will help you to setup a WordPress Multisite with subdomains so we can manage multiple sites under different subdomains. e.g. support.mysite.com blog.mysite.com

Table of Contents

Still haven’t made the decision to utilize subdirectories, subdomains or even multisite? Take a look at this compendium of Conditionals and a list of Good and Bad Parts, to definitively help you to decide.

Hands-on!

Setting up WordPress Multisite with subdomains in just four steps.

1 Starting from a standard WordPress site.

WARNING: do not experiment with your production site! period. Backup, or even better work with a clone, or simply start a clean WordPress. Both options just take a few seconds with Wetopi (watch this 20sec video Stop breaking your live WordPress)

If your hosting does not provide staging,
invest 10 secs!
Sign up and get your free development server

Once our standard WordPress site is up and running, we are ready to enable the WordPress Multisite with subdomains mode.

2 Enabling Multisite mode.

To do this, we need to modify our WordPress configuration: wp-config.php
Let’s log into our server with a simple and secure SFTP and open the wp-config.php with our favorite text editor.

We’ll find the sFTP credentials in the Options menu → Advanced section of our Wetopi clone:
We will log to enable WordPress Multisite with subdomains using the sftp credentials

This capture shows our wp-config.php file inside the html dir:
Sftp WordPress html dir content

Once opened with our editor we have to locate the bit that says:

/* That's all, stop editing! Happy blogging. */

And above, we will add the following lines:

/** Multisite */
define('WP_ALLOW_MULTISITE', true);

Done!. Once saved, we can go back to our WordPress admin panel.

3 Network Setup

If we refresh our admin page, we should now find Network Setup under the Tools menu:
Once enabled WordPress Multisite with subdomains our Tools menu shows the Network setup

In this new Network Setup section, we decide if we want to install Multisite to work with Subdomains or Subdirectories. In our case, we check the Subdomains option, and optionally we can name our network websites as well. Then, click on the Install button.

4 Enabling the Network.

Once clicked the “Install” button, WordPress will generate some configuration lines to add in wp-config.php and .htaccess.

Wait! Wetopi server runs Nginx! we don’t have .htaccess!

Don’t worry we will pretty much ignore the .htaccess step 2. Wetopi Nginx server is ready to work with WordPress Multisite so we do not have to play with server configurations 🙂

NOTE: when WordPress installs the Multisite, it will do some validations and probably return an error about a missing “wildcard domains”:

To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a “*” hostname record pointing at your web server in your DNS configuration tool.

We don’t have to forget to set up our DNS wildcard. Just in case, here we can learn a little bit more about Wildcard DNS records

Let’s go back to our wp-config.php, and add the prompted lines shown in step 1:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'sitamet.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

This is what we ended up having in our wp-config.php:

/** Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'sitamet.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy blogging. */

Once, changes in our wp-config.php are saved our network is enabled and configured. We only have to log in again.

In our WordPress Dashboard, we should see our new “My sites” section.
Once enabled WordPress Multisite with subdomains our dashboards shows the My Sites section

Now, the WordPress Multisite with subdomains feature has been fully enabled and configured.

We just need to login to the dashboard and create the websites.

We are techies passionate about WordPress. With wetopi, a Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects.

Not a wetopi user?

Free full performance servers for your development and test.
No credit card required.

See how Wetopi stacks up against your current hosting

Migrating sites to us is free and completely effortless on your part.

No hidden small text.
No commitments.
No credit card.

Try before you buy.