The other day, Klint Finley wrote a very good walkthrough of using the new Multisite functionality of WordPress 3.0. In the comments, a lot of people wanted to know how to use your own domain names. Since I’m doing that now, here’s a quick walkthrough/how-to guide.

Step 1: Manual Plugin Installation

The Domain Mapping plugin is not your regular kind of plugin. You cannot install it through the normal Plugins->Add New menu. Well, actually, you can, it just won’t work.

So first, download the plugin manually.

Note: For this tutorial, I will be using the WordPress MU Domain Mapping plugin. However, I am using the trunk version of the plugin. It has fixes in it that you will need for proper 3.0 support. Don’t try it with the regular version. (Note: The regular version works fine. This was originally written before the latest version, or 3.0, was released.)

The plugin has two main files you need to put in the proper places.

Domain mapping php file location

The first file is the domain_mapping.php file. This needs to go into the mu-plugins folder. The mu-plugins folder is a special folder, which you may not even have yet. Just create it underneath the wp-content folder and put that file into it.

Sunrise php file location

The second file is the sunrise.php file. This is a special filename for WordPress. Don’t worry about it, just put it in the wp-content folder.

Step 2: Activate Sunrise

Now you need to edit your wp-config.php file. Add this line of code to it:

define( 'SUNRISE', 'on' );

Simple, really. This will cause WordPress to go load that sunrise.php file and use it.

Step 3: Server info

Now you have to configure the domain mapping plugin so that it knows what it’s doing properly. This is easy to do, really. Go to your main domain’s admin page and log in as a super admin. Then go to the new Super Admin->Domain Mapping menu.

Domain mapping setup screen

Here you have a few different options, but two main ones that count. You can either put in the IP address of your server (as defined in your domain’s main A record) or you can put in a CNAME that points to your server. The IP address is what most people will want to use. If your server uses more than one, you can enter them all here, separated by commas.

Other options on this page:

  • Remote Login – This will make your login pages for all sites redirect to your main site to do the actual login. The benefit of this is that when you log in to one, you log into all of them. The downside is that the URL changes to another domain in order to log in.
  • Permanent redirect (better for your blogger’s pagerank) – This makes your subdomain or subdirectory sites redirect to their domains. You should leave this on.
  • User domain mapping page – Turn this on if you want users to be able to put in their own domains for mapping.
  • Redirect administration pages to blog’s original domain (remote login disabled if redirect disabled) – This makes all admin pages show up on the original domain instead of on the new domains. You need this enabled for remote login to work.

Generally I leave only the middle two on. Remote-login is iffy at best, and I want my new domain name to show up everywhere.

Step 4: Mapping the Domain

There’s a bit of a prerequisite here before you do this. When you buy a new domain, you will need to edit its DNS settings to actually point to your server IP or CNAME or whatever you do to make the domain connect to your server. For me, I just give it a new A record with my server IP in it. Easy.

Update: Okay, so there may be more to it than just that, depending on your host. Every host is different, and you’ll have to talk to your host to make them able to point the domain name at your existing site. How to do this varies from host to host, but the important thing is that when you visit your new domain (before you do this!) then you want it to go to your main site, as is.

There’s two ways you can actually map a domain to one of your sites. The user screen is the simplest way, if you left that option on before. Log into the site you actually want to map to a new domain, then go to Tools->Domain Mapping.

User Domain Mapping Screen

All you really do is put in a new domain and set it as the primary. Simple.

Note that if you didn’t get the domain pointed at your server before doing this, then your site will instantly vanish from the realm of mortal man. Setting the primary domain takes effect instantly. You won’t be able to access the site through the old domain any more.

The other way to set domain mapping is through the Super Admin->Domains menu. Here you’ll find a list of sites and their ID numbers. You can map an id number directly to a domain name here. The Tools approach is a bit easier to use, but this will allow you to map domains without visiting them, as you can access this list from your main domain. You can also correct broken domain mappings from here.

Step 5: Seeing the Mapped Domains

If you go to Super Admin->Sites, you’ll find this type of a listing:

Sites listing

You’ll note that on the right hand side you can see the column showing the mapped domains.

Special Note: See in the picture how I’m using a subdirectory install? That’s relatively new. In older versions of the domain mapping system, you had to use a subdomain installation and wildcard DNS for domain mapping to work. This is no longer the case, domain mapping works just fine with subdirectories.

Conclusion

And that’s how it’s done. It’s not super complex, but it does require some knowledge of DNS and how servers work. If you can successfully set up a multi-site install to begin with, you can probably do this as well. Just be aware that it is slightly finicky, and know that you will break your site if you put in the wrong settings somewhere. However, your main domain will always be accessible as long as you don’t try to map it, so you’ll be able to go in from there to correct your mistakes.

Shortlink:

1,194 Comments

  1. Seems I have everything in the site installed yet I can’t see the link under Super Admin (http://screencast.com/t/qDD6LDZ8Se). Thoughts?

  2. Tony, Thanks for all of your help!

    Well now I am getting a 404 error on domain2…. I’m debating doing separate installs or trying to use a vps at this point. Not sure if a multi-site is worth the trouble anymore.

    • It’s well worth it, my friend. Once you get it down, you should be fine.

      You may be having an “infinite loop” issue. I’m not sure. I would have to take a look through your admin and database.

      To really be sure, I would delete everything and start over from scratch.

      That’s what I had to do. Once I went back and started all over again, I found out where my issues were. I’m now running MU on three servers for production, staging, and development. It was a little hectic getting it up and running, but I’d rather have MU then not.

      Tony

  3. Sólo me funciono cuando coloqué ” define( ‘SUNRISE’, ‘on’ ); ” después de ” define (‘WPLANG’, ‘es_ES’); “

  4. I’m having some problems too. Both the domains I’m using are on 1and1.com.
    I set up the plugin and put in the ip address of my main site domain. Then I have the second domain A-Record point to the ip address of the first domain.
    However, it doesn’t seem to be working or actually pointing. The second domain just keeps going to the folder it’s assigned in 1and1
    I don’t think this is a problem with the plugin itself, but something with 1and1.com but since it seems a lot of people have had similar problems I thought I might find answer here.

    Thanks.

    • Ariah:

      You don’t need use an A Record for additional domains, you can use a CNAME record. Yes, you can point the A Records for “www” and “*” to the same IP address. Although I have used an A Record for primary and CNAME records for secondary in the past.

      At 1and1, you should only be hosting your primary domain. The other domains don’t need to be hosted in the formal sense, they only need to point to the primary from the domain manager control panel using A Record or CNAME records.

      You must check that you have sunrise.php in your mu plugins folder. You must check that you have added multisite support to your wp-config file. You must check that you add the correct code to your htaccess file. And you must check that you have mapped your domains under Sites by creating your new sites there, then using the domain mapping setting under the tools menu to map your domains. This is not true for primary, as primary does not need a domain mapping setting…since it’s the first domain in the system.

      • I think I figured out my problem. All of the ip addresses for all my domains on my 1and1 account are the same. So, when I tried to create a A-record it wouldn’t do it since that’s already the ip address for the second domain (as well as the first domain).
        I’m gonna try and go the cname route. I think sunrise and everything else is working fine since I’ve been able to successfully make multiple sites, just not map them properly.

      • Let me ask a second related question. If all my domains are on the same ip address, but their ‘destination’ is assigned to different folders. Could I assign a second domain to the domain1 folder and wordpress would direct it properly where it should go?

        • Here’s the thing.

          You are confusing “web hosting” with “domain management” when you talk about “folders” on 1and1.

          Imagine if you only had your first domain at 1and1 and your other domains at GoDaddy. You would point the A Records for those domains to the primary IP address.

          Those secondary domains wouldn’t even have folders at 1and1, but since you registered them AND are hosting them with 1and1, then end up having their own folders. Your primary and your secondary are all set up to have their own installs.

          But, we don’t need the secondary domain folders. But since 1and1 is the host and it’s resolving the domains at the IP, and you have folders set for each domain, it thinks that it needs to channel you into those instances that have been set up, and not route you through the domain mapping plugin.

          That’s why using a CNAME to point to the domain of primary site is a good idea.

          That’s what I think is happening.

          Tony

          • Tony, thanks so much, I don’t think I was confused, just piss-poor at explaining it. But I think you did a brilliant job explaining.

            Actually though, it did work the way I mentioned. I set the destination for the second domain to the folder where the primary WordPress network domain is and it mapped it properly. It just had to point to the right spot regardless of if it was a-record, cname or just my 1and1 folder hack.

            Thanks for the help!

            • Ah, yes. I’d forgotten that you can set the destination folder of your domains in the 1and1 domain manager. Good solution, as that redirects the domain to point to that instance. Cool. Glad it worked out. Good luck!

  5. Hi,

    For some reason I don’t have any record under Super Admin -> Domains and when I try to add it doesnt seem to really add it.
    Also, Tools -> Domain Mapping doesn’t appear at all…

    Any idea?

    Thanks,
    Ron.

    • Tools – Domain Mapping only appears for all your secondary domains. It does not appear for your primary domain.

      Under Sites is where you add new instances of domain1.com/thisnewdomainfolder.

      Under Tools – Domain Mapping for site 2, 3, etc, is where you switch from the the URL listed above to your new URL, which must be actively pointing to the IP address of the server your hosted on.

      • I did direct the new domain to this IP…what should I do to add it?
        Tools – Domain Mapping doesn’t exist (But Super Admin – >Domains and Domain Mapping exist).

        • If you’ve been reading this crazy long thread, you’ll have realized that “Tools – Domain Mapping” only exists on the secondary sites, not your primary.

          To view this panel, navigate to Super Admin – Sites, click on “Backend” of the site your want to set domain mapping for (not the first site), and you’ll see Domain Mapping under Tools in the left column.

          If you do not see it there, you have done something wrong. Maybe you did not enable multisite correctly. Maybe you did not put sunrise.php in the mu-plugins folder, maybe you did not put the code in your htaccess file from the permalinks panel.

  6. I tried to click the backend of the new site I created (subdomain website – was the only option) but it couldn’t find the page…
    Is it because the sub domain?

    Thanks a lot for the help!

    • Did you set an A Record for domain2.com to point to the IP address of your host? How long ago did you do this? It could be your domain manager is slow in repointing domain2.co to the new IP address.

      Make sure you have an A Record for “www” pointing domain2.com to the IP address of the web server.

      • I directed domain2.com to the same IP address as domain1.com but i didn’t set an A record.
        How do it do it? domain manager (let’s say godaddy) or my hosting provider?

        Thanks.

        • Yes, you would do it at your Domain Manager. You would login to your account, looking for your control panel, then set the A Record for that domain to point to the IP address of the server.

          Your domain manager will then point that domain toward the IP address/server, and the domain mapping plugin will then direct to the domain to use the appropriate site instance in your setup.

          • Hi,

            I talked with my hosting provider (they set the A record) but it still didn’t work.
            After that they told me that workpress multisite require a dedicated IP and that’s why even the basic funcionality of multisite (e.g subdomains) won’t work…

            In case you know an alternative…please tell 🙂
            Thanks,
            Ron.

  7. Do we still need to be using the Trunk version?

    I skipped that and just used the plugin version found at WordPress.org for Domain Mapping because I noticed this Ottopress Domain Mapping Tutorial was made in June 2010, and then Domain Mapping Plugin at WordPress.org had just been updated on 10/28/2010 and so I thought, well, maybe we no longer need to use the Trunk version since they make no mention of it on the official Domain Mapping Plugin info page at WordPress.org.

    So my first question is – do we still need to use the Trunk version of the Domain Mapping plugin?

    My second question is – if we DO indeed still need to be using the Trunk version, and given I have already used the ‘official’ / ‘regular’ version that is posted on WordPress.org (makes no sense to my why a specifically un-functioning plugin would be posted to WordPress.org in the first place(?)), what should I do now to back out of what I’ve done, and head down the correct path? Do I need to re-install my WordPress and start from scratch? Or just overwrite the Domain Mapping plugin files with the Trunk FIles and go back through the whole Plugin Install process anew and just re-start that process?

  8. Success, thanks to this thread and to Tony Zeoli (thanks so much, Tony). Only took 5 days to finally get it to work.

    http://www.maggiemycroft.com (domain 1: domain hosted at Go Daddy, website at 1and1)
    http://www.zoemycroft.com (domain 2: domain hosted at Go Daddy)

    My solution was to point the name servers of domain 2 in Go Daddy to 1and1 where domain 1 is hosted.

    I tried to change the “A record” for domain 2 but was informed by 1and1 that this won’t work on shared hosting because their IP is dynamic and will change.

    You need to have a dedicated server for domain 1 WHERE THE IP DOES NOT CHANGE to make this work.

    Am I right? Can someone confirm this?

    Thanks.

    • It may be correct, but if a webhost told me that, I’d switch hosts immediately.

    • If that’s what they said, then that’s true. If they dynamically change their IP addresses, then your database is not going to auto update with that new info. I’m hosting on MediaTemple DV service, which is a static IP. It will never change. I could see how a company like 1and1 could switch IP addresses for shared services. Most likely for security reasons or possibly when load balancing traffic across their shared system. I’m just guessing that could be reason enough, but I’m not an expert in hosting so I don’t know why they would do that.

      Wait, I spoke to soon. Here’s a link to Dreamhost, which states exactly what I just said: http://wiki.dreamhost.com/Static_IP_Addresses.

      Static IPs on shared services arent guaranteed, so you are right about that.

      If you really want to be safe, then you’ll have to jump up to VPS and get off of shred, I think.

      Also, thanks for the recognition. I LOVE this plugin and think it’s revolutionized what we do. I can’t tell you how excited I am to have a super admin panel to swtch between sites. It really is quite awesome…REALLY!

      I’m going to pitch to give a domain mapping presentation at WordCamp Raleigh next year. That’s if Otto isn’t a avail to do it.

      Also, it’s so important to give back to the WP community by helping out wherever you can. It is important to support the community with knowledge that moves everyone forward. This cms has changed my life and given me great opportunities I would have never had. So I give back in this way, by helping where I can.

  9. Looking to have mulitiple wordpress blogs, each with their own dedicated IP address. Does this plugin allow me to have one central WP install and run these separate blogs on their own IP’s?

  10. Seth:

    After reading all these comments, I would think its pretty clear that the entire purpose of domain mapping is to work off of a single IP. I’ve been trying my very best to support this thread for people who are having trouble, but this question is a little out there. Why would anyone care to host multiple blogs at multiple IPs, unless they are doing something nefarious to try to game the system, or they have to be on different IPs for legal or geo reasons; foe example your clients want to be hosted in their country of origin? Maybe I’m mistaken, I don’t know. Please do a better job of articulating your ask. The answer is that, and correct me Otto if I’m mistaken, that domain mapping is one IP hosting one install of WP Multisite, so that you don’t need to have individual blogs in their own folders without being able to switch between them.

    • Each one needs it’s own IP for SSL reasons. Along with privacy for each blog so a reverse IP doesn’t show they are all hosted at the exact same location.

      • Okay, sorry about my ignorance. I get it. Right, if each one needs an SSL cert for shopping cart or something like that, I can see where that is an issue and why you would then need multiple IPs. That, my friend, has yet to come up here and would certainly be an important feature for someone who wants to run multiple shops with unique IPs. I guess the question would be can you link our IP addresses tied to the SSL certs to the main IP with some kind of forwarding? I just bought two new IPs for staging and dev, so now I have three systems with three IPs, but they are all inherently separate. I think I’ll leave this one to Otto to answer. If you need to set 1 or 100 IPs in the system, for your purpose you should be able to do that, but right now the plugin runs on one IP address, which is the linked to the primary domain.

      • Seth, after reading the instructions again, Otto does say you can list multiple IPs separated by commas, so I think it is certainly possible. I didn’t realize that before. That may work for you.

  11. Hi Tony,

    I’m on MediaTemple also, using the grid server service, and I still don’t understand how I’m supposed to get this to work – everything seems fine on the WordPress Multisite side and the domain mapping stuff is fine.

    I want to migrate my perfect working domain to go to the multisite subdomain…literally:

    myblog.com -> myblog.mymultisitewp.com but can’t figure out how to do so on MediaTemple. And I still have no idea of what this domain mapping thing is doing, writing htaccess files? That’s more of a curiosity question…

  12. Hey Bart:

    I have set up dev.reesefelts.org by creating an A Record for “dev” at my domain manager.

    It’s my understanding that when publishing a new site in WPMU, a sub directory is created. For example, reesefelt.org/reesenews.

    But, I needed dev.reesefelts.org and dev.reesenews.org, so I simply created an A Record for “dev” and that worked for me.

    I would assume you can set up an ARecord for any sub.domain you want at your domain manager. You wouldn’t create a sub.domain at the host, because that would simply set up an entirely new directory on your web server.

    • Ah after thinking about it for a second, i can see where that might not work, for if you set that at the domain manager and it points to the IP address, ow would it now to attach to the subdirectory? I guess you could set that when first setting up the secondary site under Sites. I guess you’ll have to play with different set ups to make it work.

  13. […] instructions from wordpress, from NPSites, from Devin’s Video at WordPress Theming, and from Otto on WordPress.The only problem so far is that when I change the design of my Headway theme on one site it changes […]

  14. Is there a bug on the screen or is my eyes, I think im going mad…

    Anyhow.. when mapping an existing domain which is indexed by Google as having the ‘www.’ before the domain url, is there a way to keep the www (my mapped domains are without the www) Or is this to do with the htaccess file on a general wp level?

  15. […] installed then follow these instructions Otto’s Domain Mapping plugin tutorial. If everything goes well you will have your blog set up for multisites. Go into the Super Amin and […]

  16. I finally got the set up working in MediaTemple after hours of searching and reading. The tip from Bart Rossmann really helped. So I wrote the steps of how I got WordPress working. http://howtobuildablogsite.com/how-to/install-wordpress-3-mu-domain-mapping-mediatemple-hosting/ Hope it helps others.

  17. Hello,

    I’m having no luck at all trying to figure out how to setup an SSL cert using this plugin. Does anyone have instructions somewhere on how to set up an ssl using this plugin? Also, I’m not sure what type of ssl I need purchase. I believe I need to buy a wildcard ssl but not sure.

    Thanks in advance.

    P.S. Nice plugin!! Thank you!

  18. Why is this so complicated?

  19. […] domains. The difficult part was moving hosts at the same time as mapping the domains, because the domain mapping plugin tutorial didn’t cover that […]

  20. Hi.

    Whats the install steps for the wp3+ network/multisite version. (not WP-MU) – I dont have a folder called: mu-plugins
    – do I create one? What do I do?

    Thanks.

  21. 1. Install WordPress 3.0.3
    2. Create a Network: http://codex.wordpress.org/Create_A_Network
    3. Download and install Domain Mapping Plugin
    4. Access the plugin folder via FTP and move sunrise.php into the wp-content folder.
    5. Access wp-content via FTP and create mu-plugins
    6. Make sure you’ve added your mod_rewrite rules to .htaccess and code to wp-config.php

    That should do it. Then, you start adding your sites through the Super Admin dashboard. You should be careful about your configuration and what host you on. Make sure you follow instruction for general hosting service CPanel or if you’re on VPS, for Plesk.

    There are other tutorials now on the web, other than this one, that can help you.

  22. Be careful! The written instructions and the users prompts are different. The instructions mention 3 things you need to do, in order to make the plugin work, while the prompts only give you 2. This tripped me up big time!

  23. @ Tony.
    Thanks for your reply. I’ll give it a try.
    I’m using CPanel. So lets hope I can get it right.

    I’ve already got a network up and running so I guess I just need to follow steps 3 onwards of your list.
    Regards,
    Ray.

    • Okay, and don’t forget to check your settings on your mu-plugins folder, so that it’s writable at 755 or above.

      Also, don’t forget to create blogs.dir in wp-content. This replaces your “uploads” folder, and auto creates folders for your uploads from the system to individual folders created for each blog, once you set them up in the admin.

      Then, make sure you put your IP address in the Domain Mapping panel and point all your domains to that address. The plugin will map each one.

      Also, everyone has an issue with this. Remember…SITE 1 WILL NOT HAVE DOMAIN MAPPING UNDER TOOLS MENU. Only sites 2 plus….then show that panel. Site 1 doesn’t have it, because Site 1 is root.

  24. I am using shared webhosting. I have tried using an A name record.
    For this, I have created a subdomain1.domain2.com and pointed it to the IP address where my Domain1 is hosted.

    I am using Cpanel for both domains which are hosted at different hosting.
    But subdomain1.domain2.com it showing an error page of Hosting1.

  25. I am using shared webhosting. I have tried using an A name record.
    For this, I have created a subdomain1.domain2.com and pointed it to the IP address where my Domain1 is hosted.

    I am using Cpanel for both domains which are hosted at different hosting.
    But subdomain1.domain2.com is showing an error page of Hosting1.

  26. Hi.
    I’m trying to get this to work and keep getting the following:
    “The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.”

    I have a c-panel account on eg: domain.com
    Where I have many sites. One of these sites is the networked site. So: domain.com/main_site/
    I want this site domain.com/main_site/ to be the main network site. This is where I want to apply the domain mapping.

    So that the sub sites: domain.com/main_site/sub1/ etc. are mapped too.

    Is this possible or does it have to be installed at the domain.com root??? – Or will it work in the root of the “Main_site” ?

    Thanks.
    Ray.

    • The main site can’t be in a subdirectory. It has to be at the root of the domain.

    • Just following up to Otto’s reply.

      Remember, when you download and extract the WordPress .zip or .tar.gz file from WordPress.org, once you extract it on your desktop, all of the contents are placed in a folder called “wordpress.” Generally, most single site installs would upload that folder to the “root” directory, which gives you “site.com/wordpress.” But we can’t have that in a multi site network, because the network needs to use the secondary level branch for the additional sites. That
      means you should simply either download, extract, and copy the files via FTP into the top level, which is usually the “root” or main folder on your account–leaving the “wordpress” folder on your desktop empty.

      In your super admin, your first site will be denoted by a trailing “/”. The second by “/site1” and so on.

      • Thanks for the replies.
        So are you saying that I should either use my main account as the parent or it won’t work?
        I don’t really want to do this otherwise ALL my sites will then need to be networked to this and I want the sites to be individual. (Some networked to other sub sites and some not.)

        • Yeah, well, too bad.

          Let’s make it perfectly clear. It doesn’t work unless you have WordPress installed at the root of the domain.

          Simple as that, really.

        • Ray, I’m not sure what host provider you are working with, but I think you’re confused.

          Your host provider should separate your domains and give them each their individual site folders, for example:

          domain_name
          –cgi-bin
          –html

          Your html folder is “root” for that domain.

          In your cpanel, you should then see:

          domain1
          domain2
          domain3

          Domain 1 can be your networked site, with your networked domains mapped to it.

          Domain 2 and 3 have their own “root” directory.

          Sounds like you think you only have one directory to work with and that you don’t realize you can set up multiple domains in your C-Panel and keep them all separate.

          Does that make sense?

          As Otto said, it will only work if the wordpress install you want to network is in its own root folder.

          You shouldn’t be putting second and third wp directories mixed into one directory anyway. That’s kidn of messy. Keep your room clean, kid. LOL.

          • Hi Tony.

            Yep, you’re right. This is exactly the setup I have. I guess I was getting confused because my c-panel account access was set up for a domain that I don’t really use but needed to set up the account to begin with. I’m with Bluehost.

            And yes… I do have separate domains within that 1 hosting account.
            Each with their own:
            –cgi-bin
            –html
            etc.

            So my understanding is that I can use this plugin but I will need to use the trunk version for WP3+. YAY!

            Does anyone have instructions on how to use the trunk version?
            Do I simply use the trunk versions of:
            domain_mapping.php
            and
            sunrise.php
            and
            wordpress-mu-domain-mapping.pot
            Instead of those provided for the MU version?

            • Hey Ray:

              While I would hope Otto would take a deep breath before uttering a harsher than required response to your question, it is pretty well explained here that you can only use domain mapping in the ‘root’ directory of Site1. I can see why he got a little snappy. You’re not the only one who’s asked here. And, I’d be willing to bet that people ask him on the street all the time. Should these instructions be updated in a new post, maybe. I understand both sides, because Otto might not be looking at this as highly confusing to the general user, who has to read through these threads and cherry pick what’s important. We’ve just gone over this so many times, I’m assuming in his mind, he’s like, “dude…didn’t you read anything here?”

              As far as the “trunk” version goes, I think we covered this as well. It’s now part of the plugin that’s avail for download, so I don’t think that instruction should be there. It is confusing.

              WordPress network uses sunrise.php, which needs to be moved into wp-content
              Domain Mapping plugin uses domain-mapping.php, which needs to moved into your newly created mu-plugins folder.

              And, that’s it–besides adding details to your wp-config and rewrite rules to your htaccess file in the top level.

              BTW, make sure you’re running php5 with Bluehost. Not sure if they’ve made the switch. Assuming they have, but you want to make sure to add-handler in your htaccess file if they haven’t done so yet.

              Good luck with your project.

              • Thanks a mil… and yes I understand all the frustration with noob questions like mine. But seriously…. it does get a bit confusing reading this “how-to” when it has loads of conflicting and out of date info.

                That combined with my hosting confusion and total inexperience with wp networking leads to seemingly daft questions. 😉

                …. now lets see if I go this thing!!!!

    • I have installed it recently and it is working fine now. I haven’t installed it in main domain root directory but a sub-directory. So, what I did was:

      1) Main domain webpany.com
      2) Created a subdomain blogs.webpany.com pointing to webpany.com/blogs. Now, in this folder I installed WPMU.
      3) Create wildcard sub-domain i.e. *.webpany.com and point it to webpany.com/blogs
      4) When installing Network, I choose sub-domain option from sub-domain and sub-directory options.
      5) If you are using some other domain-name or sub-domain for a sub-site i.e. domain2 or sub-domain.domain2.com or sub-domain2.domain1.com etc. addon on this domain (if not on this hosting) and point it to webpany.com/blogs (in my case). If creating something like sub-domain2.domain.com then just create this subdomain2 and point it to webpany.com/blogs (in my case).
      6) There might be some issues when you use themes like some themes having Options aren’t displayed in sub-sites Control Panel. For this search on web and there is a change in 1 line of code.
      Also, you can login into main network site. After logging in, type in URL http://sub-domain2.domain.com/wp-admin/. Now, you will be able to access sub-site2 from main admin panel. Now, you can see Themes Options there in Bottom-Left.

      Hope, this helps.

  27. […]  but it doesn’t work with 3.0 multisite.You need to go to his website, and read his WordPress 3.0: Multisite Domain Mapping Tutorial. It contains a link to the trunk version of the plugin, which is modified for WordPress 3.0, and […]

  28. Why happend this?
    I go to http://wp2/ but this redirect to http://wp1/basnek2/
    I want the user continue seeing http://wp2/

    I send my captures
    Super Admin > Domain Mapping: http://clip2net.com/clip/m1037/1292951997-clip-9kb.png
    Super Admin > Domains: http://clip2net.com/clip/m1037/1292952043-clip-3kb.png
    Super Admin > Sitios: http://clip2net.com/clip/m1037/1292952073-clip-15kb.png

    .htaccess:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    wp-config.php:
    define(‘WP_ALLOW_MULTISITE’, true);

    define( ‘MULTISITE’, true );
    define( ‘SUBDOMAIN_INSTALL’, false );
    $base = ‘/’;
    define( ‘DOMAIN_CURRENT_SITE’, ‘wp1’ );
    define( ‘PATH_CURRENT_SITE’, ‘/’ );
    define( ‘SITE_ID_CURRENT_SITE’, 1 );
    define( ‘BLOG_ID_CURRENT_SITE’, 1 );

    define( ‘SUNRISE’, ‘on’ );
    /* ¡Eso es todo, deja de editar! Feliz blogging */

    Somebody can help me?

  29. […] Thanks to Otto, we managed to get WordPress 3 multisite working! Check it out: […]

  30. Hey Otto,

    1. Kick-ass plugin ;]
    2. Do you find (like I’m seeing) that while it maps the domain to work for all urls, that any WP generated links still use the old URL? Am I missing something?

    I tried to scour the comments to make sure you did not address this already, only saw one referencing links/permalinks.

    Also, I’ve noticed it does not redirect to the mapped domain regardless of permanent redirect settings (under Domain Mapping). Hope I’m not being too lazy by skimming the comments (there’s tons).

    I’m on Multisite 3.0.3 BTW and can give you super admin access to my install if you’re curious. Thanks for any follow up/help you can provide!

  31. I’m having a bit of trouble running off of Multi-Site on HostGator shared – it’s for personal sites, not trying to emulate WordPress.com.

    I have the domain pointing to the proper name servers, have setup domain mapping with the IP, created the CName – but can’t seem to get it to resolve.

    Couple questions:

    1) Should I be using a static IP assigned to my site?
    2) Can anyone who has successfully configured this on HostGator provide any additional feedback?

    • Never used Host Gator, but certainly you’ll need to use a static IP, although you can put in a range of IP’s in the field provided. If you’re on shared hosting and they change IP addresses frequently, you’ll have a problem. I haven’t faced it yet, because I’ve been on static IP’s using VPS at MediaTemple, but I’ve seen others post about shared hosts changing IP addresses. Instead of creating a CNAME, try creating an A Record for each domain pointing to the IP address and see if that works. Otto may chime in here if my instructions are off the mark.

      • OK got everything working on Hostgator

        Added a static IP, set domain as parked in Cpanel, added domain to mapping – then had to wait a little bit for domain to resolve. Even though DNS was already pointed to site, it didn’t take immediately after configuring the mapping.

        • Hi, Sahdow!

          I thonk that you can help me. When I add my domain “abc.com” as parked domain into Cpanel, I need change the CNAME too or just wait?

          My doubt is: my domain “abc.com” needs to be CNAME as “www.abc.com” or “www.xyz.com”? XYZ is my wordpress multisite installation with domain mapping.

          Can you help me?

  32. Hello!

    I have successfully set up multisite and domain mapping.
    Yippee!

    Also, my mapped domains show up as their original URLs after having checked “Domain mapping > Disable primary domain check ”
    Phew.

    However, when adding Domains, I have to add (map) both http://www.domain.com and http://domain.com to their site in order for the original URL to show up for both.

    Surely I shouldn’t have to duplicate this domain to site mapping for both http://www.domain and http://domain ?

  33. Hi, I’m trying to use the plugin to resolve issues with 3 domains parked on top of tedpenner.com. For the purposes of discussion, we only need to think about one of them, fixorfind.com.

    I followed the tutorial to install the plugin, but since we are using WP 3.1 there is no superadmin menu, it having been replaced with a whole panel full of stuff accessible as ‘network admin’. I was just posting this as a problem here when I finally found domain mapping, under the site admin tools menu. I’ll report later whether it works for me.

    Thanks for the great work on this. (I think…let you know for sure when I have it working!))

    • The Super Admin that you are seeing in this tutorial, I think is now deprecated in 3.1 in favor of a Network Admin panel. I haven’t seen it myself yet, because I haven’t upgraded, but 3.1 was just released and everyone will have to update any tutorial that displays “Super Admin.”

      • On the note of updating any tutorial with ‘Super Admin’ … excuse me going a bit off the domain mapping topic …

        Is there a way to ‘find & replace’ all instances of specific content, such as ‘Super Admin’, in all sites (each of which is mapped to a domain)?

        Excuse this newbie question. I’m busy evaluating the use of WP as a CMS vs the traditional choices like Typo3, Drupal etc and still new to WP.

        • Sorry, I was incorrect. I just upgraded to 3.0.4 for the new security path, and my Super Admin menu is still intact.

          I had been to a WordPress Meetup, where Andrew Nacin mentioned in 3.1 (which has NOT been released) that the Super Admin menu was going away.

          That was my mistake. Super Admin is still in 3.0.4. I think people are testing the beta 3.1 with the change.

          If you’re not seeing your Super Admin, then you don’t have sunrise.php in your wp-content folder and you haven’t added the “define” line to wp-config.php.

          These two lines should be added:

          define(‘WP_ALLOW_MULTISITE’, true);

          define( ‘SUNRISE’, ‘on’ );

          Let me know if you hadn’t done that.

  34. Super Admin in 3.0 is replaced by Network Admin in 3.1 which is at RC1 not Beta status. Once I figured out where everything was, and accepted that domain manager will not let me add domains for site1 (the master site), I was able to get all the domains working as I wanted. I think it is a serious deficiency that the root domain cannot have extra names added to it…but all I had to do was clone the root site in a sub-site and point them there, so I do finally have a fully working network with multiple domains. Great work in providing this plugin, really appreciate it.

  35. i can not see “domain mapping” in “tools” !!!

    • You will see Domain Mapping in Super Admin, and you will only see Domain Mapping under Tools for every other instance you generate, other than the main domain.

      Domain Mapping under Tools does NOT appear for the main domain. It only appears for your secondary domains.

      Tony

  36. It’s under Super Admin in 3.X

  37. One item that I encountered on a cPanel install that I don’t see mentioned on the current page of comments (I’ll dig through the rest of them later):

    When I add a new site under Super Admin / Sites, and the domain name is Parked with no redirection (in cPanel), the default Site created within WordPress is site.masterdomain.com. Since the domain is Parked not Subdomain, that URL doesn’t actually resolve even with the wildcard DNS entry.

    My solution for this was to 1) Create the Site, 2) Edit the newly-created Site to correct the URL in multiple places (e.g. change from site.masterdomain.com back to site.com) 3) get the site ID (by hovering over the edit link) 4) go to Super Admin / Domains and add the domain there using the ID from step 3.

    This seems to be working, but am I doing something horribly wrong and stupid or is this indeed a valid approach for cPanel users?

    • Blast it, forgot to close a strong tag after Subdomain. Can someone fix that then delete this comment?

    • Hey, Alan, I think that if you actually have that working you are doing great.

      Here’s what I did:
      1. Install multisite on the master domain for the hosting account, and enable wildcard domains for it.
      2. Create subsites.masterdomain.com site from wordpress. Since the master domain is ‘real’ not parked that works fine.
      3. Use domain mapping to have the parked domains point to subsites.masterdomain.com. Note that for that site I turned off primary domain mapping.

      This is working well for me. It did take quite a while to figure out that I could not just map the other domains to site 1, which was what I originally wanted to do. But given that limitation, what I have described is a very workable alternative.

      • When I tried what I’m pretty sure you’re describing I just get the “Apache is working on your cPanel site” page, so something about the hosting isn’t passing the wildcarded domain all the way through. That may be a deliberate decision on their part for wildcard domains, but it’s not a big deal – it just means that I actually have to add a parked domain or subdomain entry in cPanel for each site I want to create.

  38. @Tony

    I had a issue and a question with my mapped-domain.com

    ISSUE- When I type mapped-domain.com (with out “www”) it goes to my main-domain.com instead of subdomain.main-domain.com but when I use http://www.mapped-domain.com (with “www”) it works as a charm, Do you have some idea what is going on?

    FYI. my mapped-domain.com is a Yahoo domain pointing to the name servers “ns1.mediatemple.net” and “ns2.mediatemple.net”

    QUESTION- Do I have to work with my DNS Zone in my (dv) Mediatemple hosting or in my DNS zone in Yahoo? or in both?

    Thanks,

    Germando

    • Hey Germando:

      I’ll go out on a wing here and say that you should only be setting your DNS at your domain manager. No need to set any DNS entries at MediaTemple, unless you are changing the MX record, or something like that.

      I think the issue could be that you need to set A Records at your domain manager to point to “domain.com” and “www.domain.com” to the same IP as main domain. Then CNAME records for the other domains. I think that’s the correct set up. Someone else may chime in and say I’m wrong. Honestly, I’m not looking back through the thread at the moment to check. Just dropping in in the middle of a busy day to just spur some thought on your end as to following the correct methodology for setting your DNS entries to point to IP for A Records for the primary domain and CNAMEs pointing to the primary domain for the secondary domains.

      • Hi Tony,

        I removed the name servers ns1.mediatemple.net and ns2.mediatemple.net for my mapped-domain.com in Yahoo and I removed the zone I had created in my Media Temple account so I just created two A records (www.mapped-domain.com and mapped-domain.com) directly in Yahoo pointing to my IP. Exactly like you told me, it is enough to have this working, thanks :). On the other hand, for my issue with “www” I finally found my mistake, in the Word Press field I used “www.mapped-domain.com” instead of “mapped-domain.com.

        Thank you again.

        Germando

  39. Well now I am getting a 404 error on domain2…. I’m debating doing separate installs or trying to use a vps at this point. Well explained . Thanks for sharing..

  40. I did this tutorial and everything went fine. However, my mapped domains come out very SLOW. Like molasses. It takes 20 to 30 seconds to bring up the first page – going through a browser connected to the internet via a cable modem.

    The primary domain comes out really fast in under 5 seconds.

    Any advise is helpful.

    • That’s odd. It could be on your hosts side. If you’re running in on a shared service at a GoDaddy or other crap hosting provider, anything you do with php5 oriented plug-ins can make your site crawl. In my experience, shared hosting environments don’t like these php memory intensive applications. You could be on a box where someone else is sucking resources, leaving your site crawling. That’s one issue I can think of, but I can’t be sure.

      • Tony,

        Thanks for the feedback. I am not hosted on GoDaddy. I am hosted with GoGVO hosting.

        Incidentally, when I ping the main domain I get 46-51 ms response.

        When I ping the mapped domain, I also get 46-49 ms response!

        I am inclined to believe that I missed something in the configuration.

        Any other ideas?

  41. Thanks, Nice tutorial! Love your work Otto

  42. ok, here we go again…

    I am trying to set up another multi-site install, but something isn’t cooperating with me.

    Everytime I place the domain_mapping.php file into the mu-plugins folder, OR insert the following code in wp-config:


    define( 'WP_ALLOW_MULTISITE', true );
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'example.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    define( 'SUNRISE', 'on' );

    my main wordpress install times out and will not load any pages.

    what gives? I have followed the directions here, and in my own post at:
    http://wordpress.org/support/topic/multiple-multisite-installs-on-single-ip

    • Are you making sure that you’re running php 5 on that server? If not, you need to add a line of code to your htacess file and ensure that you’re running php5 for domain mapping to work.

      • running PHP Version 5.3.2-1ubuntu4.5 on a virtual machine domU under Xen

        what line of code is needed in .htaccess?

        • If you’re running 5.3.2, then you don’t need it. But you do need to put the rewrite rule in the htaccess file.

          Have you done that?


          # BEGIN WordPress

          RewriteEngine On
          RewriteBase /
          RewriteRule ^index\.php$ - [L]

          # uploaded files
          RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

          # add a trailing slash to /wp-admin
          RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

          RewriteCond %{REQUEST_FILENAME} -f [OR]
          RewriteCond %{REQUEST_FILENAME} -d
          RewriteRule ^ - [L]
          RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
          RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
          RewriteRule . index.php [L]

          SecFilterEngine Off
          SecFilterScanPOST Off

          # END WordPress

          • Hi Tony,

            I would have to echo what Brian noticed about the 2 lines here:

            SecFilterEngine Off
            SecFilterScanPOST Off

            These are the only 2 lines that I do not have on my .htaccess file

            • I put these 2 lines in the .htaccess file and I got this error.

              ================
              Internal Server Error

              The server encountered an internal error or misconfiguration and was unable to complete your request.

              Please contact the server administrator, webmaster@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

              More information about this error may be available in the server error log.

              Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
              ==============

              So I took it out – and I am back to where I was at.

              What is with these 2 lines?

              SecFilterEngine Off
              SecFilterScanPOST Off

        • Oh, you already know this. Sorry. I didn’t check your thread out at the other site. I’m not sure what the reason is for your issue. It may be beyond my competency level if it’s a server issue.

          • it looks like I was able to get it working! 🙂

            I forgot to add /blogs.dir/ and to enable the Network menu item ( Administration > Tools > Network ); step 4 at:
            http://codex.wordpress.org/Create_A_Network

            I am guessing that you are using a subfolder multi-site install, as the .htaccess rules you listed are for subfolder installs… I am using the subdomain install which has different .htaccess rules.

            What is the code:


            SecFilterEngine Off
            SecFilterScanPOST Off

            used for? I have not seen that used at all.

            also, can you use trailing slash to /wp-admin under a *subdomain* install?


            # add a trailing slash to /wp-admin
            RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

            it looks like the trailing slash code is added for subfolder installs and not subdomain installs…

            thanks again!!!

  43. darnit… the “Domain Mapping” option is not showing up under Super Admin in the base install… what am I missing???

    • Brian:

      It’s always good to go methodically back through the process. If sunrise.php is not in wp-content folder, this could be the issue. I see you didn’t set up blogs.dir until just now. Sounds like you’re racing through this thing and not seeing it correctly.

      Yes, I’m running sub-folders, not sub-domains. I haven’t won that battle just yet. I went with sub-folders, because I don’t understand the whole wildcard thing. I’m not an expert in this and have learned on the fly while reading everyone’s posts. I’ve gotten good at building it out the sub folder way, but not the other way.

  44. Thanks for this. Nice walk-through, although you might want to clarify step 2. In my setup with Bluehost, define( ‘SUNRISE’, ‘on’ ); needs to go into wp-config.php before the last require_once();

    The install screen on the dashboard alerted me to that though, so no biggie.

    Got it going and it’s working brilliantly, so thanks again.

  45. Otto (or dear and valued visitors), please please help me.

    I can’t map any domain. I have a WordPress MU (sub-directories) installation, I have a TLD domain I want to map, I have it all. A domain has A records set to point to network server IP address (shared IP). Here’s what I have in DNS:

    xyz.eu 86400 IN A some IP
    *.xyz.eu 86400 IN A some IP

    I map a domain and set a TLD (let’s make it http://www.xyz.eu) one as a primary. Then I get redirected to http://www.xyz.eu/wp-admin/tools.php?page=domainmapping&updated=add and it doesn’t work (404 error). Please help me, I will buy you a beer or two if you like, I’m getting desperate. This is taking too long. Feel free to contact me via email or here, if you prefer.

    • If you are using sub-directories, you might want to try using an A Record for primary domain, mapped to the IP address.

      Then, use CNAME records for your secondary domains, and map them to your primary domain. Don’t use A Records here. The domain mapping plugin will then handle the request and map to the correct site instance.

      That should do the trick.

      I’m not sure, but I though using all A Records was the more appropriate choice for sub.domain.com and not domain.com/subdirectories–I could be wrong about that.

    • gabi – first, do you *really* want a TTL of 86400 for your A-records? that means that DNS servers will cache your data for 24 hours before refreshing. I’d put a value of 3600 (1 hour) for your TTL.

      if you are mixing mapped domains AND subdomains on the same network install, check out the following post at: http://wordpress.org/support/topic/30-multisite-domain-mapping-and-subdomains

      if you are still stuck, check out my post at http://bridog.net/2011/01/11/wordpress-3-create-network-and-domain-mapping-plugin/ which details the entire process of getting the network set up.

    • @Tony: can I please kindly contact you via email? I have changed some settings and I need someone to help me clean this mess. Here’s my email: victoria6pl (AT) yahoo.com, please send me an email 🙂

      @Brian: your advice seems resonable but I can’t change TTL due to my host’s default settings.

  46. […] Next step is to install Donncha’s domain mapping plugin. The current version of the plugin is 0.5.3. Otto has an excellent post detailing the steps required to map the subdomains to the actual domain names you wish to use. You can view Otto’s post at http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/ […]

  47. For my first site I used WPML with Domains for each language (mysite.com [en], mysite.de [de]). After the Multidomain Mapping Plugin installation this does not work anymore. Any suggestions how to fix that?

  48. Does anyone know how to point a mapped domain to a specific page. We have alot of domain names that point to certain pages of an existing website. We have ported these sites over to wordpress, but I have no idea of how to point the domains to specific pages. Thanks for any help.

    • I don’t see how this is possible.

      I understand domain mapping as it pertains to WordPress for a specific function, which is to allow the main instance of WordPress to map to additional instances, with each domain resolving at those additional instances home page.

      Every new instance is either sub.site.com or site.com/sub.

      What you could do, is set up the Redirection plug-in or add rewrite rules to .htaccess to bypass home of the secondary sites and resolves at sub.site.com/page-name or site.com/page-name.

      That would be one way to work it out. But, it’s not the domain mapping plug-in that’s going to do that for you. You have to work on that yourself.

  49. Thats right, you don’t say where exactly to put the ‘sunrise on’ text, I think thats where a lot of people are going wrong.

  50. Hi, I am using the Domain Mapping plugin, and I am having issues with JavaScript. I am using the Tabber Widget and some custom jQuery, they work 100% fine on the main site, but not on the “sub” site. The sites are identical in 98% of the code, only 1 or 2 things have been removed as they are not needed on the 2nd site.

    I also can’t login to the 2nd site, neither from the main sites backend nor via the login form on the site.

    I am also having problems using Breadcrumb NavXT, as I can’t save settings for the 2nd site, it just reloads the page with all my settings gone.

    Any help?

    Thanks

Leave a Reply

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=""> <s> <strike> <strong>

Need to post PHP code? Wrap it in [php] and [/php] tags.