Setting two top level domains for multisite

Here is my situation:
We have a multisite set up for a .com domain with multiple subdomains:

en.domain.com, fr.domain.com, es.domain.com, etc.

For legal reasons when our visitors come from the European Union we must use a .eu TLD in a way that our site will appear as domain.eu, en.domain.eu, fr.domain.eu etc. and while browsing the site the visitor should see all the pages under the european TLD. (we serve different

While pointing a domain to specific directory on the server isn’t big of a deal since we use define('NOBLOGREDIRECT', 'https://domain.com'); obviously the .eu domain currently resolves to the front page .com

So my question is Is it possible to map two domain to the same multisite installation while preserving the sub-domain structure and allowing the visitors to browse the network under different TLDs

Any help will be highly appreciated.

1 Answer
1

What I basically did was the following:

  1. Used Domain Mapping plugin

  2. in wp-config.php – Changed

DOMAIN_CURRENT_SITE and NOBLOGREDIRECT to $_SERVER['HTTP_HOST'] as per what @toscho suggested

  1. in wp-config.php – Added:

    define('DOMAINMAPPING_ALLOWMULTI', 'yes'); // Allow sites to have multiple domains

    define('SUNRISE', 'on'); // Domain mapping plugin activation

  2. mapped relevant sub.domain.com to relevant sub.domain.eu

  3. The main site can not be mapped via the plugin though, so I added a new entry in the wp_domain_mapping table in the database for site 1 to point to domain.eu, just like Domain Mapping did for the rest of the subdomains.

    site_id 1 to domain.eu

Leave a Comment