• Home
  • WordPress
    • How To
    • Plugins
    • Themes
      • Genesis
      • Themify
      • Mysite myway
    • Security
    • Developer
    • Teaching
    • Conference
    • Chat
  • Blog
  • About
  • Freelance
    • Plugins
    • Teaching
    • Need help?
    • CV og ref.
  • Contact

Easy Web Design Tutorials

WordPress Tutorials and more

  • Home
  • WordPress
    • How To
    • Plugins
    • Themes
      • Genesis
      • Themify
      • Mysite myway
    • Security
    • Developer
    • Teaching
    • Conference
    • Chat
  • Blog
  • About
  • Freelance
    • Plugins
    • Teaching
    • Need help?
    • CV og ref.
  • Contact

10 August - 2016 By Paal Joachim 4 Comments
Last updated on: April 3, 2020

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.

Multisite folder structure with focus on mercator and sunrise file.

Multisite folder structure

 

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);

 

Multisite define sunrise code in the wp-config file.

Multisite define sunrise code in the wp-config file.

 

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.

Siteground cPanel Addon domains section

Siteground cPanel Addon domains section

 

Multisite WordPress backend

Go to My Sites -> Network Admin -> Sites -> Add New

Multisite subsites WordPress

 

Add New (Site)

I am adding the domain: theandroidexperience.com and a site title, and the admin email. Click Add Site.

Multisite Add New Site WordPress

Multisite Add New Site WordPress

 

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).

Multisite All Sites screen

Multisite All Sites screen

 

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.

Multisite Add Aliases in Mercator

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/

Share this:

  • Email

Categories: Developer, WordPress

Paal Joachim Romdahl

I enjoy teaching and creating tutorials. As well creating web sites.
I help people gain WordPress knowledge through my easy to follow tutorials and specialized training. Contact me for more information on how I can improve your WordPress skills and to help get your web site quickly up and running.

Comments

  1. Ed Hong says

    7 January - 2019

    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.

    Reply
    • Paal Joachim says

      10 January - 2019

      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!

      Reply
    • Ed says

      21 September - 2019

      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

      Reply
      • Paal Joachim says

        23 September - 2019

        Hi Ed

        It has been a while since I made the tutorial. There are likely better ways to do this today.

        Reply

Leave a Comment Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2021 · By Easy Web Design Tutorials · Built on the Genesis Framework · WordPress · Log in · ⇪

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.