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.
What I basically did was the following:
Used Domain Mapping plugin
in wp-config.php – Changed
DOMAIN_CURRENT_SITE
andNOBLOGREDIRECT
to$_SERVER['HTTP_HOST']
as per what @toscho suggestedin wp-config.php – Added:
define('DOMAINMAPPING_ALLOWMULTI', 'yes'); // Allow sites to have multiple domains
define('SUNRISE', 'on'); // Domain mapping plugin activation
mapped relevant sub.domain.com to relevant sub.domain.eu
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