How to point a top level domain to a multisite
Update 3 April 2020.
It is a lot easier to use top level domains in a multisite these days in WordPress 5.4 then it was earlier.
I just had to log in to my host. Go to a subdomain.
Example bluewinddesign.easywebdesigntutorials.com which is the subdomain for bluewinddesign.com.
Then adjust the Document root.
Example /public_html/dev/earthwinddesign.com to instead point to the multisite: /public_html/dev/mytestingbox.com
After that I logged into the multisite. I added a subsite and went to edit it.
Example https://mytestingbox.com/bluewinddesign/
I changed it to https://bluewinddesign.com
I then went to the domain bluewinddesign.com and noticed it was a part of the multisite.
using a Domain mapping plugin.
I am using the plugin Mercator by Human Made.
Download the plugin from Github.
Through FTP or your Web Host control File Manager area.
In the wp-content folder create a new folder and name it mu-plugins. (If you already have a mu-plugins folder then skip this step.)
Drag the Mercator-master zip file into the mu-plugins folder. Then extract (unzip). Rename the extracted folder to mercator and delete the zip folder.
In wp-content folder create the file sunrise.php. Include the following code:
<?php // Default mu-plugins directory if you haven't set it defined( 'WPMU_PLUGIN_DIR' ) or define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); require WPMU_PLUGIN_DIR . '/mercator/mercator.php';
The structure:
In wp-content. Here is the mu-plugins folder with the extracted mercator plugin folder. Then the file sunrise.php.
In order for sunrise.php to be loaded, you must add the following to your wp-config.php file:
(Your wp-config file might look a little different.)
define('SUNRISE', true);
The domain mapping mu-plugin, the sunrise file and the code to define sunrise in the wp-config file is now in place. We can now move on to adjust the top level domains we want to point to the multisite.
Pointing top level domains to the multisite keeping the original top level name in place.
cPanel (or other control panels)
Log into your web host and go to cPanel (if your host does not use cPanel then ask them how to do the following steps.)
Go to Domains -> Addon Domains
I am in the process of adding the domain: theandroidexperience.com as an addon domain.
(Filling out the domain name the username is automatically filled out.)
NB!
Be sure to adjust the Document Root to point to your multisite folder. Mine is public_html/mytestingbox
Then fill in a random password and confirm it.
Click add Domain.
If you already have an addon domain you want to point to your multisite folder then locate the domain and click the edit icon below Document Root and adjust to point to your multisite.
Multisite WordPress backend
Go to My Sites -> Network Admin -> Sites -> Add New
Add New (Site)
I am adding the domain: theandroidexperience.com and a site title, and the admin email. Click Add Site.
The new sub site will then be added to the All Sites screen.
Click the site name to edit the site (or use the quick edit and select edit).
Add Alias
Click the tab Aliases.
Then click Add New to create a new alias.
Here is one I made for the domain theandroidexperience.com.
Add the domain name and click the checkbox – Mark alias as active. Then click Add Alias.
Multsite – Add Alias
Check the domain url and see if it works. The addon domain should now point to the multisite folder (mine is public_html/mytestingbox) and through configuring an alias it should now point directly to the sub site. If you deactivate the alias the domain url will then instead go to the main multisite front page.
Resources:
A huge thanks to support at SiteGround for getting this process to work! Btw here is my affiliate link to SiteGround.
I just found this tutorial: catapultthemes.com/mapping-a-domain-on-wordpress-4-5-multisite/
Paal, thank you for this! I followed directions exactly but I’m not seeing Aliases tab in my edit site page. Any idea? I am running latest wordpress 5.0.2. Is this plugin still working for you with latest WP? I was formerly using MU Domain Mapping plugin but it no longer works — older sites I added are still mapping fine but any new sites will not map. Appreciate any help.
—-
Looks like I had the code: define(‘SUNRISE’, true); in the wrong spot in wp-config.php file. I moved it up like you show in your screenshot and now I see the aliases tab.
Hey Ed
I merged both your comments into one so if others happen to come across the same issue then they will also see the solution.
Thanks for sharing!
Hi there,
whats the main advantage of using Mercator plugin over WordPress default multisite handling?
I try to install mercator on my current multi site WordPress but got 500 internal server error, is mercator requires wp cli installed?
Thanks in advance
Hi Ed
It has been a while since I made the tutorial. There are likely better ways to do this today.