WordPress-Multisite + Domain-Mapping Guide

There are 2 ways in which you can map external domains to sites inside a Multisite network. You can either use ‘A’ record or use ‘CNAME’ record at DNS end (for domain being mapped).

In this article, I will explain how to setup Domain-Mapping itself and then how to configure or map external domains in WordPress-Multisite.

Before you go ahead, you must have a WordPress Multisite Network created using subdomains or subdirectory.

WordPress Multisite Domain-Mapping Setup (one-time)

This is one-time activity only.

  1. Install WordPress MU Domain Mapping plugin. Activate it Network-wide.
  2. Add the following line in wp-config.php file. (vim /var/www/example.com/htdocs/wp-config.php)
define( 'SUNRISE', 'on' );
  1. Copy sunrise.php from Domain-mapping plugins folder to wp-content folder of your WordPress setup.
cp /var/www/example.com/htdocs/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php /var/www/example.com/htdocs/wp-content/
  1. After this, go to Network Admin >> Dashboard >> Settings >> Domain Mapping menu.
  2. On next screen, either provide IP address of your server or a CNAME record which you want to use with other domains. Note: If you add both – an IP address and a CNAME record, only CNAME will work!
  3. Apart from this, you will notice few more settings: “Domain Options”. You can leave them as it is. I recommend enabling the “Permanent redirect” option.
That’s all. At this point your WordPress network is ready to handle domain mapping.

IP-Address (A-record) v/s CNAME-records based Domain Mapping

If you are confused what to use, the following may help you make a choice:

  1. IP-address based domain mapping uses A-records. IP-Address based domain-mapping will be slightly faster as it saves 1 DNS look-ups. This advantage is not significant since most name-servers use caches.
  2. CNAME-records are easy to manage, if you will be hosting 100’s of sites on your network. If you change IP of your WordPress server, say change in hosting service, then you will need to make update IP address for your own CNAME record only. In other case, you need to update IP address for all A-records for all domains mapped to your server.

Dedicated IP:

In both cases, your server must have a dedicated IP address. You can host other sites on same IP address but you cannot host 2 or more WordPress Multisite networks with domain mapping on same IP address.

Mapping External Domains to sites in WordPress-Multisite (ongoing)

You can create new sites as usual in your WordPress-Multisite network. You will need to follow these extra steps in case you wish to map one or more domains to network sites.

  1. Go to Network Admin >> All Siteslist
  2. Click on edit link for a site for which you want to map external domain.
  3. If link is => http://example.com/wp-admin/network/site-info.php?id=5 ; your site-id => 5
  4. Go to Network Admin >> Dashboard >> Settings >> Domains
  5. Look for New Domain option
  6. Enter site-id and external-domain name.
  7. Click Save button!


At this point, you need to add a CNAME-record or A-record for external domain at your DNS registrar end. Since instructions for them vary from domain to domain its not possible to post all of them here! You can Google for help or contact your domain registrar! 🙂

Link: WordPress-Nginx Configurations

80 responses to “WordPress-Multisite + Domain-Mapping Guide”

  1. First of all – thanks a bunch for the great tutorials you’ve made available for all of us!

    Now, the problem:

    I’ve setup a multisite, subdomain with w3 total cache according to your tutorials and everything works great. It’s an educational site (like edublogs) but totally free of charge (no ads), where teachers and students can create blogs. After about 5 weeks we’re now hosting 300-ish blogs and I wanted to let people use their own domains. So I set up domain mapping and that works like a charm too. But…
    Whenever you create a new post, it seems that the mapped domain blog is unable to flush the cache, so it takes a couple of minutes before the post shows on the frontpage. If I turn of page cache in W3TC it works instantly, but I’d rather not, since that effects the whole network.

    Have you got any thoughts on this, or even better, a solution? I’ve been googling around and it seems I’m not the only one, but I haven’t found any solutions as of yet. It only affects the mapped domains.

    Best regards / Micke

  2. There are 2 possible issues here.

    1. For example.com top-level domain, backend is accessible on subdomain.network.com. In that case cache might be getting flushed for subdomain.network.com rather than example.com.

    Forcing wp-admin to be accessible over example.com may work. This can be done in network-wide settings for Domain-Mapping plugin.

    2. A bug in W3 total cache plugin. If your problem is not related to point #1 above, you can report a bug to W3 total cache plugin developer. They may look into it.

    • Thanks a lot for pointing me in the right direction. Of course it was no 1 and it sounds pretty logical when you think about it. I just thought that I had tried everything, but apparently not. And once again, thanks for the great tutorials!

  3. Hi,
    I just wanted to thank you for this explanation! Many of the how-to’s are based on earlier versions of the domain mapping plugin and are really confusing. Your screen captures and explanation were perfect and I am now up and running!
    Thank you!

  4. I own a bluehost account and I use that to run a WordPress website. – http://theopinionatedindian.com/ .

    If I were to pay $13 a year, I would have the same degree of control as I previously did. But in addition I’d get featured in the WordPress reader and a bigger wordpress audience correct? And WordPress users can “Follow, Like and reblog” my posts and blogs. Is that about right?

    Basically what I am asking for is, if I shell $13 a year; does that mean I enjoy the benefits of a wordpress.com user (featured in reader,etc) and enjoy the privileges that owning a domain gives you (customization and plugins, etc)

    Thanks much. Cheers 🙂

    The blog I need help with is theopinionatedindian.com.

  5. You can map subdomains to real-domains using Domain-Mapping plugin.

    That way sub2.mydomain1.com will show up as mydomain2.com and so on.

  6. Hey Rahul,

    Thanks so much for the tuts! I’m so anxious to try nginx and will be back in the future to get that set up.

    I do have a question that I haven’t been able to find an answer for regarding multisite installs that you may have an answer for.

    I’m looking to set up a multisite install on a dedicated server and serve only the “blog” portion of multiple external domains. Main domains are served by another platform.

    I want to be able to map each of the “blogs” to a subdirectory of the already existing domains. ex – example1.com/blog

    I haven’t been able to figure out how to map a blog in a multisite install on one server or IP to a subdirectory /blog on a different server or IP.

    Thanks in advance for any input or ideas.

    • Ideally, you should use subdomains in this case. Like blog.example1.com, blog.example2.com and so on.

      You cannot map a folder to another server directly. You can although reverse proxy location /blog to another server. It will be complicated to setup, most likely have many side-effects and tough to scale.

      • Thanks Rahul. Was thinking of reverse proxy, but scaling to thousands of sites would be needed.

        • Hi Joe,

          Do you manage to get it works with reverse proxy?

          I tired and it only success on first access where accessing example2.com/blog will able to load the site but all the URL link inside the contents become blog.example2.com. Any suggestion?

  7. Hi again!

    Sorry for pestering you again, but I’ve scanned the interwebs for answers, but can’t find it.
    This time I’ve also followed your great tutorials and have setup a multisite for the school I work for. This time it is a subdirectory multisite residing at http://site.arstaskolan.se with all the blogs in http://site.arstaskolan.se/abc and so forth.
    For some of theese sites I need domain mapping and I’ve followed your instructions and it works… almost. The problem I’m having is with the media of the mapped domains. It doesn’t show. If I switch back to the original name everything works. It seems like there’s a problem with my conf in sites-available, but I can’t just find out what’s wrong.
    Here’s a living exampel. http://site.arstaskolan.se/ccarsta and the mapped http://ccarsta.se
    No images are visible. If I click media in the admin panel, still no images, but if i click edit on the image, it shows up. But if I switch back to the original site.arstaskolan.se/ccarsta everything works as it should.
    If I manually edit a post where I’ve inserted an image within the mapped domain and add /wp-content before /files in the URL it works.
    Do you have any idea how to solve this? Would it help if I submitted my conf file?

    Thanks in advance! /Micke

  8. Hello, I’m studying this configuration.

    I’m going to do a blog network with wordpress multisite and the plugin “WordPress MU Domain Mapping” to get all the main.com blog / site on site.com. I have some questions.

    To do this configuration, you need a multi-domain hosting plan?
    Or just a plan that does not support multi-domain?
    If I should take from one provider to all top-level domains without hosting plan configuring the DNS. And then you took another provider with the main domain hosting space (does not support multi-domain). The configuration work?
    With the “WordPress MU Domain Mapping” in the address bar will appear main.com / or site.com site? And in the paths of the images?

    Thank you very much!
    – Alessandro from Italy 🙂

  9. I’ve been trying to get domain mapping working in localhost with no luck for the past few days now. I’ve even upgraded from 4.0 to 4.0.1 with no luck.

    Below is the error that I get in localhost.

    Warning: dns_get_record(): Dns Query failed in C:\xampp\htdocs\Wordpress\wordpress\wp-content\plugins\domain-mapping\classes\Domainmap\Render\Network\Options.php on line 122

    Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\Wordpress\wordpress\wp-includes\functions.php on line 2714

    And this is line 122.

            $ips = wp_list_pluck( dns_get_record( $this->basedomain, DNS_A ), 'ip' );
  10. Hi,Rahul, it is so luckly I find your blog here, because I am already in trouble with the sub domain redirection in several days. I followed all solution include urs here, but the problem is still like this: all the sub.mydomain.com just redirect to the http://www.mydomain.com, may I have some clues from you?

  11. Hi,

    Thank you very much for your tutorial. I never thought I could make it…

    or almost.

    Now I have my blogs that I can access at http://myblogs.com but not at http://www.myblogs.com

    any idea on how to fix these www ?

    I have domain names at name.com where I set up a A record to the IP of my server at my hostprovider (Bluehost)

    thank you very much for your help and for making things easy for newbies

  12. Hi Rahul,

    We are migrating a bunch of separate websites in our non-profit organization to a multisite installation. We have multiple domains (e.g. mynonprofit.org, mynonprofit.ca, etc). Each of those have multiple cities (e.g. nyc.mynonprofit.org, denver.mynonprofit.org, toronto.mynonprofit.ca, montreal.mynonprofit.ca, etc.). All of the subdomains under mynonprofit.org are in Multisite now.

    We are working towards including the Canadian sites in the network in this second phase, starting with, for example, toronto.mynonprofit.ca. The other Canadian sites exist as either static websites or single WP installs which must be maintained until they are migrated to the network. This means I can’t add *.mynonprofit.ca to the multisite. What is the best strategy to effect this?

    Many thanks,

    • Even if toronto.mynonprofit.ca is hosted somewhere as normal site or a wordpress site, you can create toronto.mynonprofit.ca in your multisite.

      All you need to do is add an entry in your /etc/hosts like toronto.mynonprofit.ca. Where is IP for new server.

      This way you can work on new-site without putting current site under maintenance.

      You may find our migration guide useful – http://rtcamp.com/wordpress-nginx/tutorials/plugins/migration-with-zero-downtime/

      • Hello Rahul,

        Thank you for your quick response. I like the idea of the hosts file. What we were thinking was to create, toronto.mynonprofit.org and once the data was migrated over then domain map that to toronto.mynonprofit.ca. For domain mapping do we need to map the domain (*.mynonprofit.ca) or can we map a sub-domain (toronto.mynonprofit.ca)? Does the plugin handle that?

        Many thanks,

  13. Your tutorials have been amazing! I used them to setup WMPU, with mixed domain and subdomain sites a couple of weeks ago digitalocean (dot) com and they work great!

    Unfortunately it seems I have done something different with my second WPMU install. I honestly thought I followed all of the same instructions, but going to my second domain simply shows a “Welcome to nginx!” page. What step did I miss?

      • 1.) Yes they are on the same machine (a VPS at Digital Ocean).
        2.) Yes they share an IP Address. Where do I find the nginx config? I used ee to install it.
        3.) There is a wildward, for the subdomain (at least that was the intent).

        The DNS is something that is different from my other WPMU install (also using ee). Here is the Zone file for the secondary domain.

        $TTL 1800
        @ IN SOA NS1.DIGITALOCEAN.COM. hostmaster.riverviewinternational.org. (
        1386784836 ; last update: 2013-12-11 18:00:36 UTC
        3600 ; refresh
        900 ; retry
        1209600 ; expire
        1800 ; ttl
        @ IN A
        * CNAME @

      • I currently have the cloudflare plugin that automatically creates a CNAME record when a new site (subdomain) is created – this is working well. What I want to do is to be able to map a domain to the subdomain – is that possible?

  14. Nice tutorial, but before I start implementing it I want to ask:
    If this will work on shared hosting?

    • We never used wordpress on shared hosting. Better to go with DigitalOcean VPS which starts from $5/month only and can accomodate many sites.

      Also, please note that some shared hosting companies might suspend your service if you setup WPMU there.

      • Thanks Rahul! Im very interested about DO and will search little to check if it can handle my needs.
        btw.. Can I host few (3) sites with x100-200 daily visits each, on DO with separate wp installs for 5$?

  15. In step 2: Unable To Install Python Software Properties if continue than I have this: Unable To Create Nginx Configuration File For mydomainhere.com
    p.s. installed ubuntu 12.04.3 x32

  16. You can delete the above comments (or move to another post together with this one), I changed _size to 64 (withunncommenting that line in nginx.conf) but my site is now showing:
    Welcome to nginx!

    If you see this page, the nginx web server is successfully installed and working. Further configuration is required…. etc..etc..

  17. I didn’t set wildcard record but I mapped that subdomain (using this article) and now all is working fine:). Is this fine or I will still need setting wildcard domain?

  18. Hello Rahul,

    I have a multisite installation and multi domain mapping plugin through the Domain with subdirectory.

    I have a main site “monsite.com” and 3 domain names, “monsite.es”, “monsite.uk” and “monsite.fr”

    I want to manage the 3 domain names on my main domain.

    I followed the installation tutorial and apparently everything works, except that when I’m on monsite.fr or other, I do not have the url with my page like monsite.fr/ presentation / but only mysite.fr !

    where a poor ranking because I no longer unique url for each page.

    I myself may be planted in the settings for the plugin or other …

    what is my mistake?

    I checked “use domain mapping page” and “redirect administration …” in the domain options.

    thank you for your answer

  19. I think you have clocked the domain. Also, if you want domain A to redirect to domain B, you don’t need domain mapping.

    You should use domain redirection either provided by domain registrar as a feature or at nginx level.

  20. Hello, Rahul I Do All Setup Almost Ten Time On Main Domain, Like Domain.Com But After Creating New Site Backend & New Site Subdomain Not Found “Error 404” What I Do Next Please Help Me & Thanks! For Posting Grate Tutorial.

  21. Hi Rahul,

    Thank you very much for a great tutorial on Domain Mapping for Multisite. I have been stuck with this issue for a while until I found your post. I have followed all the steps but when I click on external.domain.com it point to my host. Is it because I asked my external.domain.com to point to the IP of my host server? Where have I done wrong?

    Best regards,


  22. I am helping a non-profit organization and it has an external domain called beta.external.com. I have a wordpress multisite hosting on domain mydomain.com. In there I have a site called beta.mydomain.com. I want that site to server the external beta.external.com. So here is what I have done.
    1. I asked the admin of beta.external.com to point to my server IP address where it’s hosting mydomain.com
    2. I then follow your steps and able to setup domain with site ID of beta.mydomain.com to map to beta.external.com

    But here is what happen I am done with the mapping.

    type beta.external.com will take to my generic page from my hosting company. Which it actually meant it pointed to my server IP address
    Type beta.mydomain.com now does the same thing by point to the generic page from my hosting. This was serving correctly before.

    There must be a small step I have missed it some how.

    • Sorry for delay Joe. Thanks for giving details.

      I think nginx server {..} block for *.domain.com is not default_server.

      Just look for a line like server_name *.domain.com; and add a line listen 80 default_server; on top it.

      You also need to remove any other occurrence of default_server for port 80 form elsewhere.

      This will make your multisite setup as default for your server.

      For reference – you can check some commented line in nginx config here – https://rtcamp.com/wordpress-nginx/tutorials/multisite/subdomains/minimal/

    • In my opinion, the domain you see in browser’s address bar should get indexed in search engine result pages.

      Other domain(s) will be redirected.

  23. Hi Rahul,

    Currently i setup multisite in my local (Development) server like this way

    nl.dev.domain.com — For Netherlands language

    de.dev.domain.com — For Dutch language

    ft.dev.domain.com — For France language

    Now, It’s time to go live

    Please Note:

    I already purchased domins like http://www.domain.de , http://www.domain.nl, http://www.doamin.fr etc…

    so, When i upload site from local to live, I think i will follow below steps.

    1) http://www.domain.in — primary Domain

    2) Create Subdomain of primary domain for e.g. —> de.www.domain.in — site id -2
    —> nl.www.domain.in — site id -3
    —> fr.www.domain.in — site id-4

    3) Install domain mapping plugin as describe in above tutorial
    4) Map domains with Site ID. 2 -> http://www.domain.de
    5) Map domains with Site ID. 3 -> http://www.domain.nl
    6) Map domains with Site ID. 4 -> http://www.domain.fr

    So, My Questions is:

    1) Am i going on right way?
    2) is it necessary to create sub domains first, And then with the help of domain mapping — map to 3rd party domain ?

    3) What are the steps to upload current’s multisite structure to Live server – I mean how should i follow search replace scripts.? Should i search and replace url with Sub domain or Actual domain ?

  24. I Can’t Add or See My New Domain!!

    I have WP Multisite installed on my cPanel. For some reason I can’t see or add my new site even after installing

    this plugin (and doing the required.)

    I’ll go step by step, because I guess I may have missed something.

    1. Took a backup and disabled all my plugins
    2. Installed and network activated the plugin mentioned above
    3. Moved sunrise.php into wp-content
    4. Added define( ‘SUNRISE’, ‘on’ ); to wp-config.php file
    5. Then Under Domain Mapping (Network Admin>>Settings>>Domain Mapping) I added my server IP Address. (I also tried the CNAME Record way. Nothing happens even after that. Waited for more than 2 hours.)
    6. Under ‘Domain Options’ the ‘user domain mapping page’ is checked.
    7. Tried adding the new site. Doesn’t get added. Gives this error – http://puu.sh/7rdHc.jpg

    More screenshots

    Did I do something wrong? What am I missing here? Please help asap.

    Thanks in advance.

  25. I dont understand.. Why this dont work for me? ALL domain I do mapping are redirected to the root domain.. Why? 🙁