How to use alias domain for multisite installation?

Is it possible to use alias-domain for multisite installation? I have tried domain-mapping plugin and Multi Domains plugin for WordPress, but this does not solve this problem.

Example:

I have installed WordPress multisite on domain.com. My bloggers have sub-domains like myblog.domain.com. Now I want to add an alias domain like domain.co.uk. So, myblog.domain.com will be the same as myblog.domain.co.uk

I have tried to set up an alias but it just redirects the domain to the signup-page (wp-signup.php)

1
1

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