Multilingual Site Network with Domain Mapping
Domain Mapping is a popular plugin, which allows running multiple, independent sites (each with its own domain), from a single Network-enabled WordPress install. We’ll explain how to use Domain Mapping with WPML.
Configuration
- WordPress 3.3
- Domain Mapping 0.5.4.1 (with some patches to fix WP 3.3 related bugs)
- WPML 2.4.2, configured with languages in directories
Our demo network consists of these sites:
- tenalpa.com – main site
- subsite1.wpml.org / blog1.tenalpa.com
- subsite3.wp-types.com / blog2.tenalpa.com
- subsite2.icanlocalize.com / blog3.tenalpa.com
If you’re not familiar with Domain Mapping, the way it works is by mirroring subdomains, which WordPress assigns in Network mode, to completely independent domain. In our example, the native subdomains are blog1-3.tenalpa.com. Domain Mapping maps them to subsite1.wpml.org, subsite3.wp-types.com and subsite2.icanlocalize.com.
You can control this mapping from the Domain Mapping admin screen:
Network Admin->Setting->Domain Mapping
Setup Steps
Most of these steps are not related to WPML. In fact, WPML doesn’t really care much about the Domain Mapping plugin. Domain Mapping decodes the domain and WPML looks at the URL for each page. We’re including here the full list of steps, so that it serves as a complete guide.
Point all sub-sites to the same WordPress install
You need to tell Apache (or whatever web server you’re using) to point all domains to the same physical WordPress install. We do this using the DomainAlias instruction.
This is our Apache configuration file:
<VirtualHost 72.249.85.20:80>
DocumentRoot OUR_SERVER_DIRECTORY/domain-mapping-test/wordpress
ServerName domain-mapping-test.wpml.org
ServerAlias subsite1.wpml.org
ServerAlias subsite2.icanlocalize.com
ServerAlias subsite3.wp-types.com
<Directory OUR_SERVER_DIRECTORY/domain-mapping-test/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
</Directory>
</VirtualHost>
Add the required directives to wp-config.php
The setup process, required to convert a single-site to a network site, will give you specific instructions. This is what we have:
define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', true ); $base = '/'; define( 'DOMAIN_CURRENT_SITE', 'tenalpa.com' ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); define( 'SUNRISE', 'on' );
Add the required directives to .htaccess
Again, you’ll get specific instructions for your site. This is what we’ve added to .htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
Settings in WordPress Admin
Finally, you need to configure the Domain Mapping plugin and WPML.
In WPML, the only required setting is in WPML->Languages. Select ‘Languages in directories’. When you use Domain Mapping, you cannot also have languages in domains.
When enabling Multisite, we choose to have different child sites in subdomains.
- IP address users need to point DNS A records or the domain to paoint CNAME record at 72.249.85.20 (happens to be our IP address)
- Domain Options (I left these to default settings as below)
- Remote Login Checked
- Permanent redirect (better for your blogger’s pagerank) Not Checked
- User domain mapping page Checked
- Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled) Checked
- Disable primary domain check. Sites will not redirect to one domain name. May cause duplicate content issues. Not Checked
The results
As you can see, all child sites perform normally.
For instance:
- http://subsite1.wpml.org/2011/12/15/english-post-2-in-english-cat-2/
- http://subsite1.wpml.org/fr/2011/12/15/french-post2-in-french-cat-2/
- http://subsite2.icanlocalize.com/2011/12/16/sample-english-post-1-in-cat-1/
- http://subsite2.icanlocalize.com/sv/2011/12/16/sample-swidish-post-1-in-swidish-cat1/
If you need help getting Domain Mapping to work with WPML for your own site, please start a new thread in our technical support forum.
Appendix – Domain Mapping Patches
We’re using the current development version of Domain Mapping. Unrelated to WPML, we found that this patch helps prevent some of the obvious problems that we encountered between Domain Mapping and WordPress 3.3:
Deleted
if ( false == isset( $_SERVER[ 'HTTPS' ] ) ) $_SERVER[ 'HTTPS' ] == 'Off';
Replaced
$protocol = ( 'on' == strtolower( $_SERVER[ 'HTTPS' ] ) ) ? 'https://' : 'http://';
with
$protocol = 'http://';
This is by no means serious debug of the root of these problems. We know that we merely disabled a mode that we don’t need and is causing us trouble.

