WordPress Multisite can handle different domains by default – but NOT with alias domains. The settings of each site store the domain. On a default install there is a subdomain or folder-structure. But you can add a single domain.
Screenshots
For example, the first two sites are with the same domain (default from install) and the third site working with a different domain, external from the default. The last one is a different domain. No plugins or custom source for domain mapping are required.
Here’s a the screenshot of the settings of the last site with a separate domain:
If you want to reduce the cookie check for each login, add the following constant to wp-config.php
.
define( 'COOKIE_DOMAIN', '' );
Otherwise WordPress will always set it to your network’s $current_site->domain
, which could cause issues in some situations.
Domain Mapping with Alias
If you require deeper customisation, such as mapping aliases to domains, plugins can help you. WordPress Core hopes to provide Domain Alias Mapping in the future, but until then you can make use of one of the following plugins:
- Mercator – WordPress multisite domain mapping for the modern era.
- WordPress MU Domain Mapping – Map any blog/site on a WordPressMU or
WordPress 3.X network to an external domain.
WWW vs Non-WWW
I don’t have the requisite knowhow about doing this with Non-WWW and WWW urls, but I think this case is slightly different. A domain like www.test.com has the subdomain www. But the www is a synonym for the web and often not interpreted as a subdomain. For all my clients, I rewrite to Non-WWW from the WWW address.
Hint for Creation of a new site
On the process, to create a new site it is not possible to add a external domain in the input field. Add an random value and after creation of the site, use the edit possibility to add the external site.