13

I'm aware of this question and others but have not found a definitive answer to how a domain should be set up with multisite so that www and non-www variants behave correctly. I believe I have wildcards set up correctly at the DNS level and the suggested solution to add define( 'NOBLOGREDIRECT', 'http://www.example.com' ); works for my main site but not other networks in the same install.

I am using the 'WP Multi Network' plugin based on some research which led me to the conclusion that if I am running several domains on one WordPress install, I should be using multiple networks, not just multisite. My Networks and sites are all added with www included in the domain field

So what is the correct way to map bare domains without www to a multisite install? Are plugins required? Should this all be handled in web server config using rewrites?

1
  • You will need to install the WordPress MU Domain Mapping plugin to map external domains to any domain in your multi site installation. Mar 27, 2015 at 8:48

1 Answer 1

17
+25

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.

enter image description here

Here's a the screenshot of the settings of the last site with a separate domain:

enter image description here

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:

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.

9
  • Thanks for this. Do you mean that for your clients you do rewrites at the webserver level i.e. before the request reaches WordPress?
    – codecowboy
    Apr 23, 2015 at 11:50
  • No, this are only the settings on the client side, in the settings of the Multisite installation.
    – bueltge
    Apr 23, 2015 at 11:56
  • I am referring to your final sentence "For all my clients, rewrite to Non-WWW from the www address."
    – codecowboy
    Apr 23, 2015 at 11:57
  • OK. Yes, this is a settings on the domain handling, webspace. But also I add rules to the .htaccess of the install.
    – bueltge
    Apr 23, 2015 at 11:59
  • 1
    @ChristineCooper Done, I hope this helps.
    – bueltge
    Jun 21, 2016 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.