Skip Navigation
March 5, 2021

This tutorial explains how to set up languages in different domains (or subdomains) in a multisite install. Please read carefully, as you will need to replace a file to complete the setup.

WPML offers support for setting up WPML to be using the ‘different domain per language’ option for the language url format when using WordPress in the multisite mode. This was not possible before this version since the implementation required a special set up involving a drop-in plugin.

This can only be accomplished by using a drop-in plugin. The difference from the regular plugins is that this one will load earlier in the WordPress execution, before the url is resolved to a specific site. sunrise.php is a drop-in and it works by being placed in the wp-content folder and enabling it in wp-config.php.

Setting this up is a two steps process described below.

Step 1: Install drop-in sunrise.php

When you already have the file sunrise.php in the wp-content folder

  1. Append content of the file sunrise.php from WPML’s WPML_DIR/inc/tools/ to your wp-content/sunrise.php file. Make sure it will be executed (e.g. will not be places after a return statement)
  2. Make sure that you have the line below in wp-config.php
    define('SUNRISE', 'on');

    If you need to change the value to on make sure that you don’t enable functionality that you do not want in your existing (but inactive) sunrise.php file.

When you do not have the file sunrise.php in the wp-content folder

  1. Copy the file sunrise.php from WPML’s WPML_DIR/inc/tools/ to your wp-content folder
  2. Add the line below in wp-config.php
    define('SUNRISE', 'on');

Step 2: Set up the domains

First, make sure that your domains have the correct DNS set and they point to the same folder as the domain of the default language.
Under WPML » Languages » Language URL format select ‘A different domain per language’ and fill in the corresponding urls and then click ‘Apply’

If you get an error message (Data not saved), try saving again with the ‘Validate on save’ boxes unchecked.

This feature is only available starting with WPML 2.8 and the sunrise.php file can be obtain from the Sitepress Multilingual CMS plugin: inc/tools/sunrise.php

How it works

The sunrise.php drop-in filters the query that WordPress uses for resolving the domain used in the url of the request and compares it to the list of associated domains of each site installed. It does this by checking each site until it finds a match. The domains used for the secondary languages are not present in the wp_blogs or wp_site tables but in the icl_sitepress_settings value in wp_options for each site.
A drop-in was required because this happens before the plugins_loaded hook is fired and before any regular plugin can add any filter or perform any actions.

Apache and DNS settings

Besides setting the sunrise.php file, as described in this tutorial, you should also create the DNS entries for all domains and point them all to the same WordPress install. For instructions, follow the FAQ entry on server settings for languages in domains.


  • Make sure that the drop-in script is being loaded and executed. e.g. WPML_SUNRISE_MULTISITE_DOMAINS is defined.
  • Check if another drop-in plugin is preventing execution of the one indicated here.
  • Make sure that you’ve set up the DNS to point all domains to your multisite WordPress install.
  • Make sure that you’ve set up Apache (or your web server) to respond to all domains for your multisite WordPress install.
  • For issues with your language switcher, make sure to install our WPML-MU-Domain-Mapping bridge plugin.