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. Hi, I installed the plugin, everything worked great. But when I tried it again, it just doesn’t seem to work. I can add a new domain, but when I make it the primary it just says it cannot find the server. Are there any incompatibilities with other plug ins? The only thing I did between the last one that work and this one was install an SEO plug in “WordPress SEO” but I am afraid to deactivate it because I might lose all the work I did on that plug in.
    I know it works, because if I do not make it the primary domain, it goes to the site that I assigned it but as soon as I make it the primary domain, it breaks. The last time it worked on a different site once I activated the new primary domain, it forced me to log in to the site with the mapped domain, but this time it does not seem to be doing this.

    Any ideas?

  2. HELP!!!

    I have recently tried to configure the domain mapping tool. It was all working well until i had to do the actual mapping. My site is ifnt.us and the sub directory site is ifnt.us/montessori, the url i was trying to map to the sub directory site was montessoricommons.cc. As soon as i hit Make Primary / OK, the whole site disappeared, and i can’t login or access it at. Im using go daddy for the hosting and I am quite new / self taught on all of this so I’ve done well to get this far. 🙂

    Now i cannot access my site at all. It was a new install, so i can begin again if i have to, but damn, thats a lotta work. Any ideas / help or pointers would be legendary.

    • If you’re on shared hosting with GoDaddy, did you add each domain to the GoDaddy hosting control panel? If so, did you create a symbolic link, pointing each additional domain to the primary domain of the network?

      Remember, that when you point a domain to the IP address of the server, the domain name has to be registered in the DNS, so that the server can field the request for that domain and point to the correct folder on the server. A symbolic link passes the request on to the primary folder in the network.

      If you were on a VPS account, it would be different, but with shared hosting, you have to set up the symbolic link between the additional domains and the primary one that you set up WordPress on as the lead in the network.

  3. Many thanks, everything works like a charm!

  4. Hello,
    I’m wondering which domain will be using to ping when a post published?
    Disable primary domain is checked.

    Thanks.

  5. Is there a version of these instructions anywhere that are updated with the changed menus and labels of WP 3.2? The instructions here don’t actually work.

  6. Never mind – the missing detail was that, if you already have WordPress installed on foo.com and you want it to respond to bar.com as well, you need to first create a subdomain called something like bar.foo.com, and go into the backend for that. I was rummaging around in the backend of foo.com for ages and not finding anything that matched the descriptions of menus and options. On the tenth re-reading of the appropriate section of this or some other tutorial, I finally realised what I was doing wrong. Now it’s all working. So thanks!

  7. Very very useful article for shared hosting people like me, recently installed my blog, and I have been trying to install add on domain and found that it is installing on sub directory on my primary domain. Tried, tried… frustrated and decided to go for a new hosting provider. Before migrating just googled and found the solution. Thnaks you have saved me $89(to signup on hostgator).

    Thank you!

  8. Hi Tony and everyone else,

    Can you review this plan for me as I am unsure how to proceed?

    My client currently has 2 websites – domain1.com and domain2.com – but has set up domain3.ca with a new web host for multisite testing, eventually migrating domain1.com and domain2.com over.

    Do I install WP on domain3.ca then add a subdomain for the 2nd site?

    Once everything is working, can I migrate both domain names – domain1.com and domain2.com – to the same registrar and set them up in the same way?

    Thanks for any guidance.

    – Paul

  9. This is new for me. I set up my main root multisite, mysiteroot.com. It is a multisite and seems to be working fine. I have other domains that I want to setup as wordpress sites super administrated through mysiteroot.com. I followed your instructions and everything seems to be working. I have exactly what I need without knowing how to use it. So, how does this work now?

    1) I have mysite2.com, at godaddy, and it is a subdirectory to mysiteroot.com. When I go to mysite2.com site through my broweser I get a 403 forbidden… I do not see a new wordpress site.

    2) Simply put, how do I create my 2nd multisite up and running? Do I add a site in multisite first, (if I do that I get invalid address). Do I create a domain map using the cname of mysite2.com? I did that and get the 403 when I go to mysite2.com through my browser.

    Have a great day.

  10. Many thanks, everything works ok!

  11. hello,
    i need someone expert in this “Multisite Domain Mapping” plugin to implement it in my site
    i have a wordpress system where every post need to be redirected to a different domain

    skype “modelim” info@ibr.co.il

    thanks

    ran

  12. […] of the tutorial that I learnt from to set up “domain mapping”. Please check the WordPress Multisite Domain Mapping Tutorial by Otto.Problems? Questions? Requests?So, how did it go for you? Did you get it set up […]

  13. Thank you so much for making this so simple to follow! I’ve read many, many different articles about how to do this correctly and I was just lost! Thanks to you I’ve got it figured out and working perfectly =)

  14. Domain Mapping settings page when I click “Permanent redirect (better for your blogger’s pagerank)” and hit save it just reloads without applying the changes. As a matter a fact if I check or uncheck and hit save it will not apply those changes. By default options 1,3,4 are checked and I am unable to change this. thoughts?

  15. […] So, I undid everything and started from scratch.  First I made sure I followed the instructions very carefully laid out on this fabulous tutorial about the domain mapping plugin. […]

  16. […] This plugin allows users to use their own domain names on your Multisite network. This plugin does require a knowledge of adding and editing plugin files and a basic understanding of how servers work and your specific server settings. A great tutorial for setting up this plugin can be found on Otto’s blog, “WordPress 3.0 Multisite Domain Mapping Tutorial“. […]

  17. […] settings. A great tutorial for setting up this plugin can be found on Otto’s blog, “WordPress 3.0 Multisite Domain Mapping Tutorial“.Multisite User ManagementThis plugin allows admins to set the default role of each, […]

  18. […] This plugin allows users to use their own domain names on your Multisite network. This plugin does require a knowledge of adding and editing plugin files and a basic understanding of how servers work and your specific server settings. A great tutorial for setting up this plugin can be found on Otto’s blog, “WordPress 3.0 Multisite Domain Mapping Tutorial“. […]

  19. […] This plugin allows users to use their own domain names on your Multisite network. This plugin does require a knowledge of adding and editing plugin files and a basic understanding of how servers work and your specific server settings. A great tutorial for setting up this plugin can be found on Otto’s blog, “WordPress 3.0 Multisite Domain Mapping Tutorial“. […]

  20. […] This plugin allows users to use their own domain names on your Multisite network. This plugin does require a knowledge of adding and editing plugin files and a basic understanding of how servers work and your specific server settings. A great tutorial for setting up this plugin can be found on Otto’s blog, “WordPress 3.0 Multisite Domain Mapping Tutorial“. […]

  21. […] mapping of full domains to their network counterpart? Do check out the great ‘Tech Ninja’ Otto’s guide on doing that. Milan Petrovic’s GD Press Tools Pro does indeed supports multi sites backups […]

  22. Hi and thanks for these excellent instructions

    I have the Head Site set up ok, together with 5 subsites, using the subdomain approach.

    I have activated the MY DOmain mapping plugin and up to STEP 4 MAPPING THE DOMAIN.

    Before I start to map each of my 5 attached domains using Tools/Domain Mapping I gather I need to edit DNS settings.

    According to “WOrdpress MU Domain Mapping” I can do this via CPANEL using “PArk a Domain”

    If however I go to park a domain such as example1.com it won’t let me because I have used an example.com email address when setting up the attached domains.

    Is there another way to do this?

    (I got a bit lost in your Step 4 with the options)

    Thanks,

  23. […] Full instructions are on the Installation page and are quite easy to follow. You should also read this page too.它需要手动安装,必须作为一个文件复制到wp – […]

  24. […] Multisite Domain Mapping Tutorial Share this:TwitterFacebookLike this:LikeBe the first to like this post. […]

  25. Hello Otto!
    And thanks for all I learn from you along the last months.

    Managing to mutate my website into a multisite, so that to better administrate all my domains and personal projects, I stumbled upon this comment “I don’t see any reason to map domains. That comment was old (pre-WP 3.1). Now that 3.1 is out, I don’t see the need for either plugin, now that a multi-network management interface is built into the core.” Source http://wordpress.org/support/topic/plugin-wp-multi-network-wp-signupphp-redirect-loop (that since I had a redirection issue).

    So my question, is the Multisite Domain Mapping Plugin still necessary with the new releases of WordPress, or can we get rid of it altogether? I’m using it and trying to see if everything works also without. And apparently it does 🙂

    Thanks in advance, ciao!
    Carlo

  26. Indeed, after few tests, I can create a new site, assigning it a parked domain, and it works fine, till I try to log in. Then it recognizes the user, but it keep looping, stuck in the log in page. I could resolve the loop only reactivating the WordPress MU Domain Mapping plugin. Once everything works fine, I can deactivate it. But perhaps I’m missing something.

  27. Hello, I’m trying to get this working but for some unknown reason it is not 🙁

    http://mhsgroup.org is the multisite. I created another site at http://en10ergy.mhsgroup.org that worked fine. I followed the instructions to install the Domain Mapping pluging, activated and configured it as above and change the A record of http://en10ergy.co.uk to be the same IP as http://mhsgroup.org but now I just get the log-in page of my host. 🙁

    Any ideas? I can’t think it could possible be? Perhaps I/ my host needs to create a symlink or something? If anyone can shed any light I’d be very grateful.

    Many thanks in advance,

    Josef.

  28. […] you need to copy a file, to modify some and to configure the mapping for the domains. A very good tutorial was made by Otto on using Domain Mapping plugin. Plugin site: […]

  29. […] that folder if needed). [Note: The plugin's readme.txt says to ignore this instruction in the Domain Mapping Tutorial written by a user, but I did and it is […]

  30. When I add */1 define( ‘SUNRISE’, ‘on’ ); to the wp-config.php file I get the error message

    Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web032/b326/apo.court851/wp-config.php on line 15
    What I am doing wrong? Is there a particular place to add this line?

    • @Mark: I am a total newbie to wordpress, but I think you might have to put
      define( ‘SUNRISE’, ‘on’ );
      (WITHOUT the leading */1) into your wp-config.php.
      I am not sure if there is neccesarily a specific place to put it, but I inserted it right before the /* That’s all, stop editing! Happy blogging. */ line. I’m not sure if I read that somewhere or put it there for no reason.
      Hope this helps, Sebastian

  31. How well does this scale? I have a client that has over 180 domains that I’m pushing to be served via wordpress. But they are pushing for http://typo3.org/ – since they know that and it is working for them.
    thanks!
    kevin

    • Scaling has nothing to do with the number of sites/domains you’re using, really. It has to do with load. 200 sites that get 1 hit per day is basically the same as one site getting 200 hits per day.

      Realistically, you take your total traffic and figure out what you need to run that. Number of sites you spread it across doesn’t matter.

  32. Help! I set up a multisite and am pretty confident I did it correctly. Proceed to actually adding a site and I crash. going to the DNS zone editor to add an A record with my server IP in it didn’t work. The site still gave me an error message. What do I put in for “host record?” Finally I just went with “redirect” – a supported menu item on my hostmonster site. Well now briscasplace.pmndesign.com goes straight to pmndesign.com. I don’t see how that will help me. And I don’t see anywhere on my Network or Site Dashboard a Tools > Domain mapping like what is in your screenshot. Where did you get that? I have the network > domain menu, but nothing in my subsites or pmndesign.com (main) site. Please point me in the right direction. If we could have an email conversation with screenshots even better. Whatever anyone can do to help.

  33. UPDATE: so perhaps there was a caching issue. I came back and voila! I have sites underneath my sites that actually go to wordpress blogs that are separate from my main site (I tested by posting a blog and it did not show up on the sub-blogs). I don’t know how this happened. I went for lunch and came back and there they were. However – I cannot access my dashboard? It brings me to a login screen, I log in. It does not shake like the wordpress logins usually do. It just does nothing. So maybe something’s broken.

    And BTW, I removed the redirect because I’m pretty sure that’s not what I want. At least I think I did. It seems to be gone and like I said, the post went to only one of the sites so there must not be a redirect.

    Please help – I really appreciate it.

  34. For more info, the address I get when I try to go to one of the dashboards is this, is there some kind of redirect problem? It looks funny.

    http://briscasplace.com/wp-login.php?redirect_to=http%3A%2F%2Fbriscasplace.com%2Fwp-admin%2F&reauth=1

  35. […] Install the WP Domain-Mapping plugin, enable it, and map the domain names into the network. Use this resource for […]

  36. Can I make permanent redirect 301 from non www to www using this plugin ? I’ve tried to do this and I get error message telling that there are to many redirections when I try to view blogs

  37. […] Step 3 : Using the Domain Mapping plugin, you’ll be able to change that subfolder URL into the domain URL ( or frankly any URL.. this is why the subdomain/subfolder choice is irrelevant, the domain mapping plugin lets you pick any URL in the world to use, as long as you can make that URL point to the WordPress installation ). Tutorial on how to do this: http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/ […]

  38. Hi, I’ve been using this plugin since 2010 and had no issues. However, for various reasons I would like to convert a blog using a blog that uses a mapped domain to a single wordpress installation. It would use the same domain name, same database, but no longer be part of the network. I’ve already dealt with the database part of the process, but how do I reverse the domain mapping? Do I just delete it from the Domain Mapping: Domains menu, or is there more to it than that?

    Thank you!

  39. Help!

    Mapping works great, except uploaded images all go 404. The files are there, but I can’t get them to show up in the post or media. I can see them if I go to edit. Main site works just fine.

    I’m running WP on Windows Server 2003/IIS 6 with the Ionic rewrite.

    Any ideas?

  40. […] Another detailed walkthrough is found on OttoPress: WordPress 3.0 Domain Mapping Tutorial […]

  41. I using directory structure system i.e http://www.mysite.com/site1, http://www.mysite.com/site2.

    But managing them is a headache and long process. If I have huge data in any site, I have to re-do everything for the other site.

    Is there any way I reduced this long process.

    I know importing/exporting XML file data but in this way my widgets and plugins still do not apply themselves. I have do it by myself.

    Please anybody help!

  42. Adding a new domain doesn’t seem to work for me… I enter the site ID and domain name and click save, but nothing happens; no error, but the domains list remains empty. What could be the problem?

  43. […] the problem. But honestly it just took me half an hour to find that article.Ok so here it is,  WordPress 3.x Multisite Domain Mapping Tutorial written by a guy named Otto. It’s a really well written article for the time that it was […]

  44. […] love wordpress. With the onset of 3.0, you no longer have to fiddle with Wordress MU. You can autogenerate 100’s of sites in a matter of […]

  45. i’m setting this up on wordpress 3.3.1 and i’m getting the “Please edit your /usr/share/wordpress/wp-config.php and move the line define( ‘SUNRISE’, ‘on’ ); above the last require_once() in that file or make sure you updated sunrise.php.” message.

    this is an existing wordpress install that i’m just adding this plugin to. the entry is in the wp-config.php, and the files are in the right places afaict but the message persists. is there any debug I can enable to track this down ?

    • Ok – i got that straightened out – i was updating the wrong sunrise.php. so the mapping seems to work well, except for the links generated on the network admin drop down. those links point to the original domain names. is there any way to change that ?

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.