If you have created your first WordPress Multisite Monster, chances are that you will want to add a subsite to it soon! Since WordPress Multisite uses only a single code base to present multiple WordPress websites, you need to do a little bit of networking to make it all work. You may have heard of wildcard settings, redirects, and htaccess edits to make this work. However, for most server environments, the only big networking changes you need to make has to do with symbolic linking your subsite’s domain name to your Monster site’s root folder. This is accomplished by configuring a connection that links a sub-domain name to a certain folder every time the server reaches for it – and hopefully that folder is the one that contains our WordPress Multisite code!
Links are from Mars, Servers are from Venus
Unfortunately, not all servers, and in particular some hosting companies, are all alike. This means you may have to do a bit more networking than this post will cover. But if you’re a Media Temple (mediatemple.net) customer, you’re in luck! The following will work for you (and possibly other hosting environments).
Understanding Symbolic Links
The key to setting up your first sub-domain site is to make sure your web server understands where the WordPress Multisite code resides. This is accomplished by creating a symbolic link (sometimes referred to as symlinks or soft links) that redirects any HTTP requests from your sub-domain to the primary domain’s folder (and where the WordPress code resides). This happens so quickly that the user never notices the transactions taking place behind the scenes. All they see is a loading website and the final content displayed within their browser.
Behind the scenes, the server is making a connection between the symbolic link address and the folders being used by the primary domain address. We know that the sub-domain does not have any real files or folders. It is simply a link that allows WordPress Multisite to serve website content in different ways, all dependent on which URL a user connects to the server from.
Symbolic Link Setup
To set up your first symbolic link for your sub-domain site, you begin with:
Deciding which domain will serve as the primary domain name:
Deciding what our sub-domain site’s domain name will be called: mysubsite.mysite.com
Connect to your server via SSH:
–> cd domains
Remove the empty sub-domain folder (if it exists):
–> rm -rf mysubsite.mysite.com
Create a link to the main domain:
–> ln -s mysite.com mysubsite.mysite.com
Log into the primary domain as the Super Admin:
Login and navigate to the WordPress Multisite subsite section for creating new sites by going to:
Network Admin –> SITES –> ADD NEW
When you create a new WordPress Multisite subsite, you need to add the SITE ADDRESS, SITE TITLE, and ADMIN EMAIL. Note that the you only need to add the subdomain name since the DOT and mysite.com is already added for you.
Make sure your new site is listed and spelled correctly by navigating to:
Network Admin –> SITES –> ALL SITES
Test the mysubsite.mysite.com domain name in your browser to make sure your WordPress Multisite is displaying its default theme correctly. Also check your mysite.com domain name to make sure your main site is also still there (since surprises are bad)!
And that’s it! You should be capable of replicating this process for each of your sub-domain sites you need to create within your WordPress Multisite Monster.