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
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.
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:
This capture shows our wp-config.php file inside the html dir:
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:
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.
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.
At wetopi, we want to minimize the friction that every professional face when working and hosting WordPress projects.
In short, we are just techies passionate about WordPress. With wetopi, a specialized WordPress hosting, we want to go further to offer professionals and agencies a platform to work efficiently and effectively.
Not a wetopi user?
Free full performance servers for your development and test.
No credit card required.