There is an unfortunate design choice in WordPress, where the ‘Network Admin’ site is assigned to the www.
hostname of a wildcarded domain.
This is a poor choice because almost invariably the Site administrator will want to assign the www.
hostname to an IP address available on the internet.
To allow master.
example.com to be the Network Admin default site it is necessary to change the
1 2 3 4 5 |
wp-includes/admin-bar.php wp-admin/network/site-new.php wp-content/plugins/multisite-clone-duplicator/include/admin.php wp-content/plugins/multisite-clone-duplicator/include/admin.php wp-content/plugins/multisite-clone-duplicator/template/network_admin_duplicate_site.php |
files of your WordPress installation.
As of WP-4.4.2 the change looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
wordpress@webserver:~/wordpress_n$ diff ./wp-includes/admin-bar.php-orig ./wp-includes/admin-bar.php 290c290 < $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); --- > $blogname = preg_replace( '#^(https?://)?(master.)?#', '', get_home_url() ); 464c464 < $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); --- > $blogname = preg_replace( '#^(https?://)?(master.)?#', '', get_home_url() ); wordpress@webserver:~/wordpress_n$ diff ./wp-admin/network/site-new.php-orig ./wp-admin/network/site-new.php 83c83 < $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); --- > $newdomain = $domain . '.' . preg_replace( '|^master\.|', '', $current_site->domain ); 174c174 < <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> --- > <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^master\.|', '', $current_site->domain ); ?></span> wordpress@webserver:~/wordpress_n$ diff ./wp-content/plugins/multisite-clone-duplicator/include/admin.php-orig ./wp-content/plugins/multisite-clone-duplicator/include/admin.php 300c300 < $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); --- > $newdomain = $domain . '.' . preg_replace( '|^master\.|', '', $current_site->domain ); wordpress@webserver:~/wordpress_n$ diff ./wp-content/plugins/multisite-clone-duplicator/wp-cli/wp-cli-site-duplicate-subcommand.php-orig ./wp-content/plugins/multisite-clone-duplicator/wp-cli/wp-cli-site-duplicate-subcommand.php 110c110 < $newdomain = $base.'.'.preg_replace( '|^www\.|', '', $network->domain ); --- > $newdomain = $base.'.'.preg_replace( '|^master\.|', '', $network->domain ); wordpress@webserver:~/wordpress_n$ diff wp-content/plugins/multisite-clone-duplicator/template/network_admin_duplicate_site.php-orig wp-content/plugins/multisite-clone-duplicator/template/network_admin_duplicate_site.php 31c31 < <input name="site[domain]" type="text" class="large-text" title="<?php echo MUCD_NETWORK_PAGE_DUPLICATE_FIELD_ADDRESS ; ?>" value="<?php echo $data['domain']?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> --- > <input name="site[domain]" type="text" class="large-text" title="<?php echo MUCD_NETWORK_PAGE_DUPLICATE_FIELD_ADDRESS ; ?>" value="<?php echo $data['domain']?>"/><span class="no-break">.<?php echo preg_replace( '|^master\.|', '', $current_site->domain ); ?></span> |
Then also define the constant COOKIE_DOMAIN
in wp-config.php.
1 2 3 4 5 6 7 8 9 10 |
/* Multisite */ define( 'WP_ALLOW_MULTISITE', true ); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('COOKIE_DOMAIN', 'candlish.net'); define('DOMAIN_CURRENT_SITE', 'master.candlish.net'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); |
If you are correcting this from a default installation it may be necessary to also adjust the database, as documented here ==> How to change a Multisite primary domain, and elsewhere.