Wordpress Mu Primary Site Assignment

Anyone who has tried to map domain names to multiple sites within a WordPress network has probably encountered a few issues.  This process isn’t exactly the easiest thing to do.  Why is that?  Well, the primary reason mapping domain names with WordPress is difficult is due to the lack of a physical file structure and how WordPress uses permalinks (read more about WordPress permalinks here).  Your domain registrar will require you to properly point your domain to a physical location, e.g. http://mysite.com/subfolder/ – which is typically fine unless you’re using WordPress because technically, that path doesn’t physically exist.  So how does one get around this?  With a WordPress Multisite Domain Mapping plugin.

In this tutorial, I’m going to describe what the WordPress MU Domain Mapping Plugin (written by Donncha O Caoimh) does and how to properly configure it within a WordPress multisite network.  I’ve tried to write things out as detailed and as simple as I possible can.  If you’re a tinkerer and you’re stuck, feel free to drop us a comment on this article and we’ll get back to you as soon as we can.  We love helping out.  If you’re REALLY stuck, you might consider hiring us to work on your setup.  Other users have and we’ve made their domain mapping setups work perfectly.  Contact us here and we’ll get your WordPress network mapped properly.

Let’s get started!


What We’re Going To Accomplish

  1. Setup a WordPress Multisite Network
  2. Install and configure the WordPress MU Domain Mapping Plugin
  3. Create an additional site within your network
  4. Configure settings with your registrar/hosting provider
  5. Assign a mapped domain name to the new site

Step One – Setup A WordPress Multisite Network

All of the setup steps have been detailed by the guys and gals at WordPress.  You should check out their documentation on it before proceeding.  If you’ve already setup your network, continue on to Step 2.


Step Two – Install and Configure the WordPress MU Domain Mapping Plugin

This plugin is no run-of-the-mill WordPress plugin in the repo.  It’s REQUIRED that you install this plugin MANUALLY.  Here’s the deets:

  1. Download the WordPress MU Domain Mapping Plugin.
  2. Extract the zip archive to a location of your choosing.  If you’re in need of a program to extract the archive, we recommend 7-Zip.  We also recommend downloading it and other utilities from Ninite.
  3. Navigate to your “/wp-content/” directory on your WordPress site and create a folder called “mu-plugins”.
  4. Verify that you also have a folder titled “/blogs.dir/” within the “/wp-content/” folder as well.
  5. From the location where you extracted the plugin, we’re going to copy two files: “domain_mapping.php” and “sunrise.php” into the “/mu-plugins/” directory and “/wp-content/” directory, respectively.  Please compare to the screenshot here to verify that you did this correctly.
  6. Navigate to the root of your WordPress install and open “wp-config.php”.
  7. Insert the following:

    and make sure it appears above the following line

  8. Upload your updated “wp-config.php” file to your web host.
  9. Log into your WordPress site and navigate to the “Network Admin” section.
  10. Click Settings > Domain Mapping.  This is the interface for configuring your domain mapping across the entire network.
  11. Find the IP address of your web hosting server and enter that information into the Server IP Address field.  You can also use a CNAME record instead if that’s your preference.  You can find this information by pinging by your domain or within your web host’s admin panel (e.g. HostGator uses cPanel and your server’s IP address can be found in the sidebar to the left, all the way at the bottom of the screen under Account Information > IP Address).
  12. The Domain Options checkboxes below are important to decide how the mapping and subsequent redirection is handled.  To explain what each of these options means:
    1. Remote Login – This forces all login attempts to be redirected to the main site’s URL. For instance, if we had this enabled, all of our network sites would be forced to redirect to http://fronterahouse.com/ to log in. We don’t want this, so it’s disabled.
    2. Permanent redirect (better for your blogger’s pagerank) – This enables the use of a 301 redirect instead of a 302. We recommend turning this setting on.
    3. User domain mapping page – Enables a site-specific domain mapping interface page located under Tools > Domain Mapping. We recommend this if you allow users to register their own site.
    4. Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled) – Much like Remote Login, this makes use of redirecting the user from their URL to your URL, but the big difference here is that this applies to ALL administration pages. This is up to you, but we leave ours turned off.
    5. Disable primary domain check. Sites will not redirect to one domain name. May cause duplicate content issues.This is NOT recommended for proper SEO. Enabling this setting ignores redirections from non-WWW to WWW and vice versa. This can create major issues with duplicate content in search engines.


Step Three – Create An Additional Site Within Your Network

This step is very straightforward.  Navigate to your Network Admin Dashboard and click SitesAdd New.  Fill in the details as you see fit, click Add Site, and your new site has been created.


Step Four – Configure Settings With Your Registrar/Hosting Provider

At this point, we need to discuss a few things about domains, registrar’s, and hosting.  When you purchase your domain name, you’ll use a domain registrar to do this.  Typically domain registrars will also offer web hosting so that their customers can have an all-in-one place to manage everything from.  GoDaddy or DreamHost are good examples of companies that provide both services in one place.

However, you can also choose to purchase your domain at one place and your web hosting elsewhere.  For instance, you could have GoDaddy as your registrar, but you could use Bluehost for your hosting.  Or you could have DreamHost as your registrar, but use HostGator as your hosting provider.

The reason I bring all of this up is that if you split your domain registration and your web hosting between companies, you’ll need a way to tell the registrar where your hosting is located.  We do this with name servers.

The crucial point here is this:  set your domain name servers to point to your hosting BEFORE you begin doing any domain mapping work with WordPress and let the information propagate.

Why is this so important?  Without getting too complex, changes to name servers and DNS records can get pretty complicated due to “propagation” and TTL (time-to-live) values.  It’s crucial to have these values set properly beforehand so that if you make a mistake with your WordPress multisite domain mapping, you can then eliminate DNS as a potential culprit when troubleshooting.  For more information on DNS and propagation, DreamHost has a really good Wiki topic on it.

After changing your name server settings at your registrar, give the system time to update before proceeding to the next step of this guide.  Usually, name server changes occur after about an hour, but sometimes these can take longer.  DNS and name server changes can (but often don’t) take 24-48 hours to fully propagate around the internet.

As an additional tidbit of info, I’ve included links to some major hosting and domain registrar providers’ “how-to” sections for setting DNS and name server information:


Step Five – Assign A Mapped Domain Name to the New Site

Finally, we’re on to the good stuff!

Provided you changed the name servers in the previous step and let them propagate, all changes from this point on should be instantaneous.

We’ll now finalize the domain mapping settings for your new site and get this ball rolling:

  1. Log into your new site’s dashboard.
  2. Click on Tools > Domain Mapping.
  3. Under the Add new domain section, you should see a box preceded by “http://”.  Type your domain name in this box (e.g. “www.mysite.com” or “mysite.com”), but DO NOTcheck the checkbox for Primary domain for this blog.
  4. Click the Add button to save your new domain name.
  5. You’ll now see two domain name options under the Active domains on this blog section with radio buttons next to them.  The radio button should be in front of the current URL to access your site.
  6. You should now add another domain name that either includes the “www” in the URL or excludes “www” depending on how you entered it on Step 3 and add this exactly like you added the previous one.  This is important for SEO purposes as Google can potentially see your site as two individual sites if not properly handled, which you definitely do NOT want.  By adding both here, you can ensure that the “non-www” URL forwards to the “www” URL or vice versa.
  7. At this point, I highly recommend double- and even triple-checking your work up to this point to ensure that all of the steps have been completed properly.  After completing the next step, you will be logged out of the dashboard and if you didn’t let your name servers propagate, you won’t be able to log back into your site dashboard until it finishes propagating.
  8. When you’ve reviewed that you completed all the steps properly and the name server records are properly updated, click the radio button next to the domain name that you wish to be primary for your site.
  9. Click the Set Primary Domain button.
  10. You’ll now be logged out of the site.  If you look in your omnibox of your browser, you should notice that the URL has updated for your site.  If you’re unable to log back into your site, don’t panic!  You haven’t allowed for the propagation of the DNS servers to take into account your name server changes so you just need to be patient and give it more time.  I’m an impatient guy myself, so I understand how difficult it can be to just sit and wait, but that’s what you’ll need to do.

Conclusion – WordPress Multisite Domain Mapping

At this point, you should be rock-n-rolling with your shiny new domain name pointed to your WordPress install!  You should also have the “non-www” forwarding to the “www” or vice versa and everything should be dreamy, right?  If it’s not for any reason, leave us a comment below or give us a shout on our contact form and let us know.  We’re always willing to help out.

Tags:CMS, domain mapping, multisite, SEO, wordpress

Article written by Mike Smith

7ArticlesMike Smith on LinkedIn | Email Mike Smith

Mike is the Electronic Media Director and Site Administrator for Frontera Marketing Group. Since building his first website in 1996 using animated GIFs of flaming skulls on GeoCities, he's graduated to advanced HTML5/CSS3 techniques and is well versed in front-end design and back-end development with PHP/MySQL. When not building websites, Mike likes spending time with his family, playing video games, writing articles about technology, photography, and building custom computers.

The most powerful feature of WordPress Multisite is the ability to have multiple sites under one parent WordPress environment. This tutorial will help you add new sites to your WordPress Multisite environment and map a custom domain to the new site.

Please note: WordPress Multisite is available as an add-on for Startup, Growth, and Scale plans, and included for Professional, Business, Premium, and Enterprise plans.

The first step is to add your new domain to the User Portal. For more information on how to do this, please visit “Add Domain in User Portal”. If you’re using a subdomain, and plan to use several more, our support staff can enable domain wildcarding for your account, which will prevent the need to add each subdomain to the domains list.

Once you have added the new domain to your User Portal, you will now need to create the site in your WordPress Multisite install. To do this, please follow these instructions:

  1. Navigate to “All Sites”. The URL is /wp-admin/network/sites.php
  2. Note: For example purposes, your website is domain.com
  3. Click “Add New” at the top. It’s next to a key-looking icon.

You’ll be taken to this screen. You will see three fields:

  1. Site Address
  2. Site Title
  3. Admin Email

For Site Address, choose one word. Do *not* choose something like www.domain.com, because then it becomes www.domain.com.domain.com. A good input example would be dev or subsite2. (You can have any site address as long as it is not blog, www, or multiple words).

Site Title will be the new title of the subsite. This can be anything you would like and can be changed later.

Admin Email can be your clients email or yours. Whomever’s email is placed here will have access to the dashboard of the newly created subsite.

Once you get to the screen below, do NOT change any values.

You have successfully created a subsite on your Multisite environment.

Mapping a domain to your subsite

Mapping a domain to your subsite allows you to use a different purchased domain to access a subsite on your Multisite network. For example, subsite.domain.com can be accessed as subsite.com.

To do this you will need to download the plugin WordPress MU Domain Mapping.

You will need to “Network Activate” the plugin, so that it’s available for all sites.

Once the plugin is “Network Activated” you will need to do some additional setup to ensure proper functionality of the plugin. There are two steps you need to take, the first is to add the following line to your wp-config.php file.

The second step is to access the folder through SFTP. In there, you’ll see a file called ,, move this into the directory.

Other steps are typically required but we manage the rest through our platform.

Once the plugin setup is completed, navigate to the Domains page. Here is the URL path associated with it:
/wp-admin/network/settings.php?page=dm_domains_admin

Ignore the section “Search Domains” and focus on “New Domain”.

First you’ll need to find the Site ID for the site we just created. This is easily done by going to the “All Sites” screen and locating the number under the “ID” column.

Take note of the Site ID and place it in the Site ID textbox on the Domain Mapping page.

Add your domain that you want associated with the subsite, keep the Primary textbox checked, and click Save.
You should then see something similar to this at the bottom this:

You have now successfully “Domain Mapped” your newly created subsite. This process automatically adds your new Mapped Domain to the WP Engine User Portal, to be used by your site.

Comments

Leave a Reply

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