How to map domains to sites within WordPress multisite

24 Comments

One of the coolest (if not the coolest) parts of running a WordPress Multisite installation is mapping domains to turn network sites into unique domains that can carry their own identity. I’ve been using, and enjoying, this technique for some time now. WPCandy is a mapped domain, in fact, on top of the GooRoo primary domain.

If you are yet to get your feet wet with domain mapping and WordPress, this is the tutorial for you. We’re going to walk through what we need to get started and the best way to map the domains to our multisite installations.

Let’s get started!

Just a heads up: this tutorial assumes you already have a working WordPress Multisite installation running. If you don’t, see our tutorial that will show you how to enable WordPress Multisite.

Step 0: Park your domain on top of your primary domain

Before we get started with the actual mapping, the first thing we want to do is park the domain we’d like to map on top of our primary network domain.

Let’s break that down.

Your primary network domain is the domain that is, by default, always a part of your multisite URLs. If your blog URLs look like site1.network.com or network.com/site1, then your primary network domain is network.com.

But we want to map a domain, like site1.com, to site1.network.com. To achieve this the first thing we want to do is, through cPanel or any other management system, park site.com on top of network.com. You will know that this is working when you visit site1.com and it brings you to network.com.

We’re doing this first so that the mapping can be, hopefully, ready to go by the time we’re finishing.

Step 1: Download and install the domain mapping plugin

Now you will want to download the WordPress MU Domain Mapping plugin from the WordPress Plugin Directory.

The installation process for this plugin will be slightly different than you are typically used to. The plugin instructions actually do a pretty good job of explaining the process though, so I’ll defer to that. Follow the setup and configuration instructions provided in the Plugin Directory.

Step 2: Set domain as a mapped domain (but not the primary)

With the plugin active you can now visit the particular site you’re mapping to at site.network.com/wp-admin and visit the Domain Mapping screen under Tools → Domain Mapping.

Enter your domain (the parked domain from Step 0 above) and click “Add.” At this stage, do not check the “Primary domain for this blog” checkbox. Just in case there’s a problem we want to make sure we can still access our site!

Step 3: Test the newly mapped domain

Once that’s done, test the domain to see if it’s working. Before, visiting site1.com would bring you to network.com. Now, visiting site.com should bring you to site1.network.com. When this works, you know the mapping is set up correctly!

Step 4: Once working, switch the new domain to “primary”

Now that we know site1.com will bring us to site1.network.com, we can switch that domain under Tools → Domain Mapping to “Primary domain for this blog.”

Optional: other mapping considerations

There are a number of settings you can tweak with this plugin (found under Super Admin → Domain Mapping). The settings I like to use are these:

Each is mostly self explanatory, but let’s go over them.

Remote Login
This will allow you to have cross-domain logins.
Permanent redirect (better for your blogger’s pagerank)
This will use a 301 redirect rather than a 302 redirect when sending visitors to the mapped site.
User domain mapping page
If this is unchecked, the domain mapping options won’t be available to individual site admins.
Redirect administration pages to site’s original domain (remote login disabled if redirect disabled)
This will determine whether your WordPress Dashboard URLs match the original domain (site1.network.com) or the new domain (site1.com).

What you choose really depends on how you want your mapped domains to operate.

Are you mapping domains?

Are you mapping domains on your WordPress Multisite installation? If so, how are you using them?

If not, why not?

24 thoughts on “How to map domains to sites within WordPress multisite

  1. I tried getting this to work last week and I was about to pull out my hair. I will have to try one more time nut use your tutorial. Domain mapping should work on shared hosting setups, right?

    • I have mapping set up on a couple of shared hosting setups, yes. So if there’s a problem with it, it’s likely not due to only the shared hosting. There must be something else.

      If you run into trouble again, let us know here!

  2. Cheers for the tips (and the site, btw).

    I moved over 4 WP instals to a multi-site setup last weekend. Have remote login enabled and so far, it’s working like a charm. (One question pops to mind: I read on Otto’s blog that it’s “iffy at best” – Why would that be?)

    Now I’m considering how to set up W3 Total Cache on the network of sites. It seems that so far it doesn’t work with remote login enabled, but maybe I’m mistaken. Would be cool to see a tut on that :o)

    cheers!

  3. Nice tutorial, although I would have expected some more depth in the “parking” part of the tutorial (step 0) as that is by far giving people the most headaches!

    • Really? I thought parking a domain was a by and large straightforward process. I tend to use cPanel or WHM, but either way it’s a main menu item.

      What about the parking do you think is most confusing/headache inducing?

  4. Teeny tiny correction: your “remote login description is off. ;) It’s cross-domain logins, not redirecting to original blog’s url. ;)

    the parking part *does* trip up a lot of people:
    – ones who do not use cpanel
    – ones who need to use an add-on domain instead because they aren’t set up in the main web account of their host (which is where parked domains will point to)
    – smarty pants who get confused by the term and think domain parking :D
    – people who get stumped because they want mail too (I got asked this at least 4 times this week)
    – hosts that have it but cal it something else. Dreamhost, for example, uses the term “mirroring” which doesn’t sound correct, but it.

    Yeah, pretty much ran into all kinds of issues.

    • Thanks for the correction, my bad. Fixed.

      Bummer that the parking trips people up like that. I guess I’m spoiled in that I haven’t run into that, or else I’ve known what I was going to do when setting up the host, so prepared for it :).

      I’m kind of glad I glossed over that. With all of the variations and issues you pointed out, wouldn’t it be pretty complicated to cover all of that in a tutorial?

  5. @Ryan CNAME vs A records is the main problem, when you don’t know what either one really means.

    I used Otto’s tutorial to set up Multisite and step 4 was the only step I struggled with. As Otto says in his last paragraph “It’s not super complex, but it does require some knowledge of DNS and how servers work.”

    So if you don’t have that knowledge for the simple fact that you never played with WPMU, this is the only step that can trip people, imho.

    In the end I used a combination of Otto’s tutorial and sth else that unfortunately now I cannot find anymore…

  6. My biggest problem was the sunrise.php in /wp-content/ didn’t update when the domain mapping plugin updated… Was causing errors in the admin when I activated the domain mapping plugin (kept telling me to add define ‘sunrise’ in config).
    I had to remove the wp-content one and recopy over the one from within the plugin directory… Then it worked fine.

    I’m considering removing all data from within the sunrise.php in wp-content and include the one from the plugin dir path so I don’t have that issue again with the next update.

  7. Great to find a tutorial on this as none out there, but as with others I’m confused on parking bit!

    my two blogs are at
    just-plod-it.com
    and just-plod-it.com/challenges

    but in cpanel, it says that just-plod-it.com/challenges is not a valid domain, I’ll look into parking to find out more.

  8. Actually think my problem may be that both my web addresses are add-on domains…not sure if it is possible to park add on domains? Or is that wrong?

  9. DUDE!! I just go it to wok after like months on-off of trying.
    Finally got it to work =]
    Thank You!!
    Btw, those who are using the Multi Site activating plugin, DON’T!!
    That was one of my mistakes.
    Another, is to PARK the domain. I finally realized what was going on, and now everything works!! =]
    THANK YOU!!

  10. I used otto’s method and it worked more or less but I can still hit the site with the old sub-domain url which is a problem for google… any idea how to get rid of that? I might just start over with this method if I can’t get it working.

  11. ugh, finally figured it out, I’m going to post here to maybe save others countless hours of time… So if you’re a newbie to the network setup you might not understand what it means to ‘network activate a plugin’ when I went through that part of the tutorial I just activated the plugin on my main site’s plugins page (since it was there) and moved on. Instead of doing that you MUST active it for the network by going into the super admin area and then plugins…

    brent
    @
    mimoYmima.com

  12. Ryan, thank you so much! I was trying to set up a multisite subdomain network for the first time with another domain. Set up the DNS “A” record but blog still wouldn’t forward to tld.com. Parking my domain on top of the primary domain did it. Now I can set up the rest. You made it a piece ‘o cake!

Leave a Reply

Please note that WPCandy is a moderated community.

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>