There are two different ways where external domains to sites can be mapped inside a WordPress multisite network.
1. You can use the A-record.
2. You can use the CNAME record at the DNS end for each domain being mapped.
Before getting started with this mapping guide, make sure that you have a multisite network already created. You’ll need to have the sub-domains or sub-directories in place before beginning.
1. Get It Setup
You’ll only need to do this once. Install the MU Domain Mapping plugin, or similar one, and activate over the entire network. You’ll then need to add this line to your wp-config.php.
vim/var/www/exampledomain.com/htdocs/wp-config.php
You’ll then need to copy the sunrise.php file from the plugins folder over to your wp-content folder within the setup of WordPress. Then go into your Domain Mapping menu option and provide either the IP address of your preferred server of your preferred CNAME record. If you provide both, only the CNAME will work.
You also have some other domain options to select. The permanent redirect option is the best one to choose as it provides a link equity transfer. The others are more about your own personal preferences in the setup of your multisite.
2. Should the CNAME Be Used?
If you plan on hosting dozens of different domains on your multisite network, then the CNAME record is generally the best option. This is because you only need to update the IP address for your own CNAME record if you change the IP of your server. If you use the A-record option, then you’ll need to update every single domain for all of the domains that have been mapped. Have 1-5 updates like this isn’t bad. Updating over 100? That’s a time-eater.
Just remember that your server must have a dedicated IP address. You can host other sites on the sampe IP, but only one multisite network with domain mapping can be on any given IP address.
3. Keep It Going
Now that you’re through that one-time setup, you’re ready to map domains as often as you want on your multisite network. You’ll need to go to your All Sites list through the Network Admin menu of options and then click the link to edit the site where mapping to an external domain needs to occur. You’ll find the site-id at the end of the link beyond the .php file name. If your site-info.php?id=7, then your site-id is 7.
Now you need to go back into your Network Admin menu of settings and get into the dashboard. Under the dashboard is a settings option, which will give you access to the domains. Look for the New Domain option here and then enter the site-id that you’ve identified from above. You’ll also need to include the domain name.
Hit the Save button and you’re done. Remember to uncheck the primary box if necessary to have the update happen accurately.
Now You’re Ready To Update the Other End
Once you’ve finished this part of the domain mapping process, you’ll need to add your A-record or your CNAME record at the registrar end of the DNS. You’ll need to go through your hosting provider in most instances to make this happen. The only problem here is that every domain has a different set of procedures that must be followed to update this portion of the domain mapping. You’ll need to search through your hosting provider’s instructions to update this information.
A common issue that occurs after this process is completed is that the case cache flush happens on the sub-domains instead of the top-level domain. You can force the wp-admin to be accessible over the top-level domain to help counter this issue. If you encounter it, this process can be corrected in the network multisite settings from the mapping plugin you installed.
Why Use This Process Instead of Having One Primary Domain?
The answer to this is a question of management and link equity. Sub-domains may rob a primary domain of equity. If you have sub.exampledomain.com, for example, there is some thought that the search engine algorithm updates treat this as canonical data. The same is true for sub-folders such as exampledomain.com/sub. By having the multisite install completed, the equity builds for each site unless the content is directly duplicated because each has its own presence.
The other benefit is clearly administrative as it creates a cleaner set of navigational tools for the user. Instead of being in a strange sub-domain on a primary site that doesn’t reflect the subject matter of the content, each can have its own location instead to improve the user experience.
This WordPress multisite domain mapping guide will help to get your network setup and functional in just a few minutes. Follow the steps above today and you’ll be good to go.