Knowledgebase

How to configure and manage domain mapping in WordPress multisite

Using domain mapping you can map a domain name(s) to sites within your WordPress multisite network. For example, if you have a site yourdomain.com/site1 in your network you can map other domain names to it (e.g. yourdomain2.com), so that the site can be accessed using the mapped domain name(s). WordPress multisite doesn't have built-in options to do this. It can be done with a plugin. One of the most widely used plugins for this purpose is the WordPress MU Domain Mapping Plugin. The plugin works both with a subdirectory and subdomain multisite network. In this article we'll list the things that you have to do to make domain mapping work and we'll describe how to install and use the plugin.

  • Before you start make a backup of the WordPress files and of the database.

  • In order for the mapped domains to actually work you have to do a few things on DNS and server levels. You have to point the domain name(s) to the hosting account on which the WordPress multisite installation is hosted. You can do this in a couple of ways. One way is to change the nameservers of the domain name with the ones of the domain name associated with the WordPress installation. You can do this from the domain name registrar with which the domain that you want to map is registered.

    The alternative will work only if the domain name that you want to map is associated with a hosting account (meaning a different account; not the one on which the WordPress multisite installation is hosted). In this case you don't have to change the nameservers of the domain that you want to map. Instead go to the hosting account associated with that domain name and edit the DNS A record by replacing the IP address with the IP of the server on which the WordPress multisite installation is hosted.

  • On the server level you have to make one change on the hosting account on which the WordPress multisite is installed. You have to make sure that the domain name(s) that you want to map is added to the vhost file of the account. HostKnox customers can do this from the Domain Names and DNS Settings section of the Pixie control panel. Just add the domain name(s) that you want to map (there's a link for that in the black area on the right). This is similar to parking a domain name in cPanel.

  • Install the domain mapping plugin. You can do that automatically from the admin panel of your WordPress or manually. In order for the plugin to work your WordPress has to be installed directly in the root web-accessible folder on your hosting account; that's the public_html folder. Whether you install the plugin automatically or manually you'll need the plugin files anyway. You can download the plugin from the page of the WordPress MU Domain Mapping Plugin on the official WordPress site.

  • After you install the plugin unzip the downloaded plugin archive that's on your local computer. In it you'll find a file sunrise.php. Upload that file in the wp-content folder of your WordPress installation.

  • Modify the wp-config.php file of your WordPress by adding the following code (make sure you add it above the line that says that you should stop editing the file): define('SUNRISE', on);

  • Go to the network admin of your WordPress multisite. You can do this by logging into any of the admin panels in the multisite network as a super admin and then going to My Sites menu in the upper left corner>Network Admin>Dashboard. In the network admin panel itself go to Settings menu>Domain Mapping sub-menu. This will automatically create in the database a database table required for the plugin.

  • On the same Domain Mapping page of the network admin panel add the IP address of your main WordPress site (the one corresponding to the installation) in the field for Server IP Address. In fact, this is not required for the proper functioning of the plugin but it will make visible in the admin panel of each site in the multisite network the options for adding domain names. If you don't want these options to be available in the admin panels of the sites but just in the network admin panel, you can just unmark the checkbox User domain mapping page that's on the Domain Mapping page of the network admin panel.

  • After all these things are done you can use the plugin to map domain names to sites in the network. You can do this in a couple of ways. One way is to map domain names to sites from the network admin panel. To do this, in the network admin panel go to Settings menu>Domains sub-menu. On the page that opens put the ID number of the site to which you want to map a domain in the Site ID field, then type the domain (e.g. yourdomain2.com) in the Domain field, mark/unmark the Primary checkbox depending on whether you want this to be the primary domain for the site, and click on the Save button. The primary domain is the one whose URL is shown in web-browsers.

    The other way to add a domain name to a site is from the admin panel of that site. After you access the site's admin panel go to the Tools menu>Domain Mapping sub-menu. In the respective field on the page that opens type the domain name that you want to map to the site, select whether you want it to be the primary one and click on the Add button.

For some more details and screenshots read the tutorial on how to manage domain mapping in WordPress multisite. There you'll also find information about the additional domain mapping configuration options.

You may also find useful the following WordPress multisite tutorials (or their respective shorter article versions):

Was this answer helpful?

 Print this Article

Also Read