In this tutorial, I will show you how to map external domains to sites on your WordPress network, without the use of a plugin. I have found some conflicting information on this process, so I wanted to clear things up. Up until recent versions of WordPress, the best way to do this was with the WordPress MU Domain Mapping plugin. This plugin worked fine at the time, however, it has not ben updated in over 2 years, and is not listed as compatible with the latest versions of WordPress. It turns out that for recent WordPress installs (4.4+), this plugin isn’t actually necessary and the mapping can be set from within WordPress itself.
Step 1: Make sure your network site has a dedicated IP address
Having a dedicated IP address will ensure that you don’t run into any issues when performing the next steps. Make sure your hosting plan includes this feature, or add it on. Most shared hosting plans do not have this feature, but in my experience they aren’t the best for WordPress networks anyway. You would be better off with a VPS or hosting specifically geared for WordPress network installs.
Step 2: Point the domains to your network server
Go into the hosting account of where your domains are registered, and head over to their DNS settings. Point the A record of the domains you want to map to the IP address of your network site. By changing the A record only, you maintain the ability to manage the additional DNS records (MX etc) however you’d like. Go ahead and click Save when done. Note that at this point the domain will take some time to propagate, I have seen it take anywhere form 10 minutes to several hours. If your site has to be launched at a specific time, I would complete this step a couple of days before, just to be safe.
You will know your DNS has resolved when the error page changes to a message saying something about a misconfigured IP address etc. The domain is now pointing to the server but it doesn’t know what to do with it. We now need to tell the server about the external domain.
A quick note: If you have purchased additional domains and want them to direct to the new site, go ahead and set up 301 redirects for those.
Step 3: Park your domains
For this step, you will need to login to your hosting control panel (most commonly cPanel) and look for the “Domains” tab. From there, select the option that says “Assign a domain to your cPanel account”. Type in the domain name and wait for the “Verify Ownership” area to load. It should say that the domain is pointed correctly. If not, the DNS has likely not yet resolved. Now select the “Parked Domain” option, click “assign this domain” and let it run. This part will take a few minutes, so just leave the page open and let it run. If successful, you should now see the domain in your domain list with a type designation of “Parked”.
Step 4: Make a backup
For this next step we will be modifying the WordPress database, so it’s always a good idea to make sure you have a recent backup. I use BackWPup and find it works well. It is very simple to do a quick database backup or a full backup of all of the site files. Once you have it configured, you can set a chron script to run on a set schedule, and store the backups on the server or to an external service (i.e. DropBox). I find weekly backups are sufficient for most cases, but if your site is constantly updated, daily backups might be a better choice.
Step 5: Update your mapped sites in WordPress
Note: These following steps all assume that you are a “Super Admin” user on the network.
In WordPress, change the URL of the mapped sites to their external domains. This is found in the Network admin area under “Sites”. Click on the name of the site and change the “Site URL” to the mapped domain.
At this point, you will need to re-login to your site, as the URL is now completely changed to the mapped domain URL rather than the subdirectory version. The login is the same as your general Network login (as long as your are a Super Admin). At this point it is good idea to test the site (front end as well as admin) in order to make sure there are no broken links, missing images etc.
Pro tip: If you would like to keep the site “hidden” until it’s ready to go live, but you would still like to test the site after mapping the live URL, you can hide the site from public view. This option is found in the Network admin area. Click on “Sites”, then the name of the site, then the “Settings” tab. From there scroll all the way to the bottom, the section is called “More Privacy Options”. Change the site visibility from “Visible” to “Site Members Only”. Now, if an external user tries to access the site URL, they will simply see the WordPress login screen. This way you can thoroughly test the site exactly as it will appear live before it goes public. After reviewing the site, simply turn “More Privacy Options” back to “Visible”.
I hope this post helped clear up some confusion regarding mapping domains on a modern WordPress network. As always, happy coding.