How to use alias domain for multisite installation?

Domain Mapping via Core

You don’t need to use the domain mapping plugin if you are planning on running a WordPress Multisite with top-level domains and/or sudomains. WordPress allows you to change a sub-domain to a top level domain once you have added the site settings, see the screenshot below. Core works perfectly without Alias, more then one domain.

enter image description here

Often is helpful to add the constant COOKIE_DOMAIN and set to empty to the wp-config.php if you use the subdomain install.
define( 'COOKIE_DOMAIN', '' );

The background for this:

       /**
        * @since 2.0.0
        */
       if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
               if ( !empty( $current_site->cookie_domain ) )
                       define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
               else
                       define('COOKIE_DOMAIN', '.' . $current_site->domain);
       }

Source form core: https://core.trac.wordpress.org/browser/trunk/wp-includes/ms-default-constants.php?rev=21881#L75

Otherwise WordPress will always set it to your network’s $current_site->domain and you won’t be able to login into any of the other sites.

Alias Possibility

But the default of WordPress can’t use alias, more than one domain, in the Multisite install.
Currently I think is the plugin Mercator a good way to solve this.

Leave a Comment