WordPress MU Domain Mapping 0.1

A long sought after feature in WordPress MU is domain mapping. That’s where a blog on a WordPress MU site can be “mapped” to a new domain. WordPress.com has an advanced domain mapping feature that has proved to be very popular with users even though it’s a paid-for upgrade.

This domain mapping plugin isn’t quite as powerful and still requires plenty of testing. So, while domains and “sub domains” or hostnames can be mapped to individual blogs, there are a number of caveats:

  1. Remote login does not work. It’s possible to be logged in on the main site, logged in on the domain mapped blog as a different user or not logged in at all there!
  2. It only works if your WordPress MU site is using sub domains.
  3. It’s the 0.1 0.2 release. It’s basic.

Here’s the plugin page, and the download page. I’d like to hear how well it works for you.

I’m submitting this plugin to the WordPress MU plugin competition. There are only 2 other entries so the odds on my winning are pretty good!

I should have a Sitewide Tags update later this week, with thanks to Thomas Schneider who came on board last week to help and has done some super work!

Ron and Andrea found a bug in pre release testing that I forgot to fix in 0.1, so grab 0.2 if you were (un)lucky enough to grab the first release! Thanks Trent for testing too. Follow me on Twitter to get the inside scoop on my WordPress plugins, including a sort of super secret Twitter plugin..

WordPress MU is the multi blog version of WordPress that runs on WordPress.com and many other sites.

Author: Donncha

Donncha Γ“ Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Google+ and Twitter.

82 thoughts on “WordPress MU Domain Mapping 0.1”

  1. “Long sought after” is putting it mildly πŸ˜€

    This plugin gives MU a whole new set of uses and I, for one, know exactly what I’m going to do with it.

    It will be interesting to learn if there are any Google/duplicate content issues we have to work around but the convenience of being able to run multiple WP-based sites from one installation is a knock-out blow.

    Well done Donncha, Thomas and all the testers.

  2. Thomas is helping me with the Sitewide Tags plugin, not this one, but he’s updated that plugin with a few nice bit of code.

    Shouldn’t be any duplicate content problems – the blog will redirect for search engines too and they’ll update their URLs given enough time.

  3. The download page says the current version is 0.1, but the download link is 0.2 so just download and you’ll be getting the newest version. I screwed up the version number in the readme/php files.

  4. You could do the multi-domain login thing by using a one-time-use-nonce.

    Basically, on a domain mapped site, stick a script call into the wp_head. That script call will be back to your main login domain. It will get cookies for that domain if the user is logged in there, and you can then generate the nonce and return a redirect with that nonce in the URL (as a GET) back to the original domain. There, that nonce can be checked and validated, and if it’s good, the new login cookies for that domain can get sent along with a blank script. A transparent or zero-pixel image would also work, but a script call seems more clean.

  5. @Otto: sounds very useful, I’ll certainly check it out; I wonder if the image method might not be better for also catering to people who switch off Javascript? Then again, are there even very many people paranoid enough to do that these days?

  6. Otto, Donnacha – that’s mostly what WordPress.com does but I haven’t got around to doing that just yet. I think you can do it without Javascript, just by issuing a header redirect, but if a user has Javascript turned off then they probably have cookies off too.

  7. Just tagged 0.3 to fix the version number on the download page, and also generate the $current_blog and $current_site properly, especially if you’re insane enough to have more than one entry in wp_site πŸ™‚

  8. Thank You loads for the plugin, this is one of the things that I need to turn my various wordpress sites into one hosted platform for ease of use and upgrading

    Thank You again!

  9. Excellent! Very exciting!

    A few questions:
    1. Aside from the ‘freshness’ and ‘immaturity’ of this plugin, what’s keeping this from being a 1.0 release?
    2. What other features (bugs? πŸ˜‰ do you intend to introduce before this plugin achieves 1.0 status?
    3. You mention ‘generate the $current_blog and $current_site properly’. I’m not sure what meta info that refers to, but might you also include $blog_id to give us a little more info about? That’s been something I’d like to see added, (along with IP, since our WPMU install is on a cluster, and I occasionally need to divine the server to view the error_log ;-).

    BTW, Thank you! Thank you! Thank you!

  10. Thanks Donncha for this! I hope everyone votes for it in the plugin competition! You should put site-wide tags in as well as it is wicked as well! So happy to have this working after my past months of pain without it πŸ™‚

    1. Hello Eric, what’s your email add? We are using plesk for dns management of our domains. We find it difficult to configure wordpress mu in plesk. Can you help us?

  11. Wow this is one great plugin for all WPMU users, but I don’t really get how it works (well I cant really test it for myself).. do we have to park the new domains in our host before we can map it to a blog?? I mean parking a domain is necessary right??

  12. Clay – It needs to work with non VHOST installs, it needs to detect DNS settings of the domain you want to map, it needs actions or filters for integration into some sort of payment system and I’m sure there are plenty of other ideas once it starts being used.

    You should print_r() $current_blog and $current_site, they’re useful objects to know about! The $blog_id bug was fixed in 0.2.

    When you have a cluster of machines with multiple IP addresses things get more complicated. Can you add multiple A/CNAME records for a single domain name/host name? Otherwise they’ll have to transfer their DNS to your name servers.

  13. Domain mapping has been a two or three line hack to WPMU since 1.3 or so, hasn’t it? Swap some current_site to current_blog in wp-settings.php IIRC.

    So what does this plugin add? Is there a risk of the same content appearing at multiple URLs?

  14. MJ – that was a hack and not very elegant one either that always annoyed me.

    No risk of duplicate content, search engine bots will be sent to the new domain.

  15. Enseignement – whenever I get a chance to work on it. The source is out there so if you have a spare hour to work on it you might be able to add that in!

  16. @Richard and Donncha,

    I’m working through this on CPanel, so I’ll be sure to let you know how it works or doesn;t work. But I wanted to ask you both about this new plugin.

    What I liked about Richards hack for Mapped Domains on WPMu is that it allowed each domain to act kinda like its own WPMu install, could this plugin be made to do something like that?

    Thanks for the goodness Donncha, the WPMu community has been dying for this little plugin for a long with. And between this and the Sitwewide tags plugin you are officially on a major, major roll. Oh yeah, not to mention you thought up WPMu–there is that too.

  17. Jim – not going to happen, sorry. Even though there’s a “wp_site” table, and code to do basic checking of the url against it, I don’t think it’s supported very well.

    The domain mapping is for blogs only, not sites. The domain mapping hack always annoyed me because it mixed the two concepts up so much.

  18. Does it work on WPMU sites using subdomains? Because it’s not working for me.

    My site has URLs like:

    I have setup the DNS entries:
    http://www.new-domain.com > blog.ourdomain.com_ip_address
    new-domain.com > blog.ourdomain.com_ipaddress
    blog.new-domain.com > CNAME > blog.ourdomain.com
    (also tried with blog.new-domain.com > CNAME > username1.blog.ourdomain.com)

    I setup the plugin by uploading files as specified in readme.txt. I configured the IP address in the plugin settings as site administrator. And added the domain name for the blog site in question.

    The URL successfully redirects to our blog site. But it attempts to start the registration process:


    So does it only work with WPMU sites using the subdirectories and not subdomains?

    Or any ideas what I’m doing wrong?

  19. Call me stupid, but I was looking to verify that this is the right solution for me.

    I have my main site stockphotosarchival.com which has WordPress installed on it. This installation has 12 categories. We have 16 other domains that we want to pull up specific categories from the main site…

    So basically, going to stockbathroomsarchival.com would need to pull up stockphotosarchival.com.

    I’m sorry if it seems like I am talking in circles, but it’s something that I’m not all too familiar with, let alone I don’t know much about WordPress and WordPress MU.

  20. I found an interesting bug. If you mass activate plugins on one of the mu blogs, it will take you back to the log in screen. Meanwhile, activating them one at a time works…

    Kinda nifty…

  21. Hello !

    Great Plugin, but we have one Problem. We use Version 0.3 with mu 2.61, but there is no chance to add “www” to the domain.

    The “Main-Blog” and the mu-installtion contains no “www”, it is like http://domain2.com , http://blog4.domain2.com etc.

    – I mapped the domain http://new-domain.com (no chance to add www)
    – In the backend i changed all entries to http://www.new-domain.com (siteurl etc)
    – the backend is now complete with www like http://www.new-comain.com/wp-admin/...

    but my site is only http://new-domain.com

    Any Idea ?


  22. Can you briefly elaborate on what’s holding back the subdirectory-based (vhost=0) site support?

    We are currently using a similar custom-coded solution for domain mapping, but yours seems to be more customizable (currently, we only support domains that match the blogname, eg. test123.com -> bloghost.com/test123).
    I’m thinking of replacing that code with your plugin, if I can get it to work with subdirectories. And Otto put out a good idea of “calling home” to see if the user is logged in and then setting a cookie. I suppose that could be done πŸ™‚

    Also, is there any progress since v0.2?
    Are you planing on releasing a 1.0 for the competition? πŸ™‚

    Great work. Keep it up! πŸ˜‰

  23. Great plugin. I just have a bug in the dashboard. When I click “Visit Site” or the link for my different blogs backends it goes to the subdomain instead of the domain I mapped, and I have to log in again in the subdomain.

  24. and one more link not working its at the log out.

    I’m loged at myblog.com and I click log out it uses myblog.wpmu.com\wp-login.php?action=logout
    instead of

    So when I return to myblog.com/wp-admin/ I’m still log on.

  25. Chionsas – the main thing that’s holding it back is time. I don’t have time to investigate. I’ll be happy to look at patches however, if you have them.

    JuanManuel – unfortunately that’s unavoidable as the mapping is only done in the blog, not in the dashboard. The “login again” issue is known. It’s the first point on the plugin page.

  26. The Flash uploader seems to be busted on blogs that have domain mapping enabled. I’m using 2.6.2

    Only the browser is available. (I verified that an unmapped blog on the same system works as it should)

    When you do use the Browser uploader, The image uploads fine, but when you click Insert Into Post. The screen goes blank and nothing happens. No image inserted.

  27. Congratulations Donncha!

    I happened to look at how the votes were going just before they hid that info and it was pretty clear that CommentLuv was running away with it but, clearly, with their special mention, the judges recognized the importance of the (somewhat niche) problem you’re tackling with this plugin.

    As it happens, I’ll be getting into gear and having a shot at getting Domain Mapping working tonight, following the Cpanel-specific instructions at WPMU Ed and BavaTuesdays – I’ll post back here to let other CPanel users know what worked best for me.

  28. Donncha, This is an issue that has already been reported, but no solution found. On any domain mapped sites, when you try to upload an image via the media uploader, it looks like it uploads fine. When you try to insert the image into the editor, it gives all sorts of errors depending on what browser you are using. On FF, it’s just a blank media uploader and nothing is placed in the editor. On IE, you get an Error 2060 permissions error about not being able to access the javascript uploader. On Safari and IE, you also get the login page for the site in the media uploader window asking you to login. Any help would be great! Thanks!

  29. Andrea to the rescue with a solution here by editing the blog address under Site Admin. Works for me.

    A suggestion for future releases: the plugin should update the blog address setting so it doesn’t require manual intervention. It should also revert back the setting if the user deletes the mapped domain. But then what happens with their image links ? Those will be broken as images uploaded with the mapped domain will have the url of that domain ..not the subdomain. This is still the first release, so I’m sure we’ll get fixed up good.

  30. David,

    While that solution does work (not quite for me though), it is not what Donncha has intended with the domain mapping. If you read this comment by Jim of Bavatuesdays and see Donncha’s response in the next comment: “The domain mapping is for blogs only, not sites. The domain mapping hack always annoyed me because it mixed the two concepts up so much.”

    Like me put up a hypothetical of why Donncha’s method works better, IMO. Let’s say you have hello.world.com and you domain helloworld.com to hello.world.com. When people visit helloworld.com or hello.world.com, it should resolve back to just helloworld.com. Perfect. But what if you want goodbyeworld.com instead of helloworld.com. Sure you can change the 4 entries to goodbyeworld.com, but then helloworld.com won’t resolve anymore. Yes, you can also put a domain forward on the helloworld.com to resolve to goodbyeworld.com or even do a .httaccess redirect, but in both cases, it is not elegant and adds to load times. What if you simply wanted to stop using domain mapping? You would have to go back in an re-edit the four links to reflect the old hello.world.com. Donncha’s plugin makes life easy by accomplishing two things:

    1) Map a (or many) domain names to a blog.
    2) Make it easy to manage the blog’s mapped domain name(s).

    Keep this in mind, the more redirects you do, the slower the site will run and when you need to unmap a few domains…it becomes a nightmare to manage. I know because I’ve been using this method for a long time.

  31. Hi, I’m having problems creating a category in the write post using myblog.com/wp-admin/post-new.php but when I unmap the blog and use myblog.mywpmu.com/wp-admin/post-new.php I can create categories. Any one having that problem?

  32. Is the Server IP Address parameter necessary? Or is it merely to provide a convenient place for users to see how to update the CNAME value:

    If you want to redirect a domain you will need to add a DNS “A” record pointing at the IP address of this server: IP not set by admin yet.

    I’ve got a Load Balancer, and entering an IP address will likely cause issues with a ’round robin’ workaround we have in place to resolve issues with Internal HTTP requests.

    NOTE: this was also posted on the WordPress Support forum:


    I’ll update that post as I can…

  33. Hey Guys.. Thanks for plugin Donnacha – however we’re experiencing a few issues

    For a start – once a domain is mapped – some admin links show the new URL, some (mainly plugins) use the old subdomain. So, some admin links are broken.

    Same as above – image paths are broken once a domain is mapped and blog URL is edited (to fix issue 1).

    Any de-mapped domains create a major headache – sub domain may have been taken by someone else.

    I notice wp.com continues to use the sub domain throughout the entire admin process and only maps the root URL.. This seems the perfect fix.. Anyone have any comments on this??

  34. Hi

    I’m using WPMU 2.7.

    Installed the plugin. Parked the domain so it points towards the same installation. Alias worked fine, but it did not show the correct blog, only showed the default home page.

    I then had to edit the database domain_mapping table manually, and change the blog_id to the correct one. All of my domains pointed to blog_id 1 for some reason.

    This may help someone out there!

  35. Donncha, the plugin looks extremely helpful. However, I’m having doubts about the initial WPMU install: IÒ€ℒd like to keep the code in a subfolder in order to keep things tidy, so WPMU would be in mydomain.com/wpmu, not in the root folder.

    Then IÒ€ℒd like to have blogs named blog1.mydomain.com, blog2.mydomain.com and so on.

    WhatÒ€ℒs the best way to set this up when installing WPMU? Should I choose mydomain.com/blogs or blogs.mydomain.com (or even mydomain.com) as the main site address?

    I guess the latter option will then require long URLs such as blog1.blogs.mydomain.com and blog2.blogs.mydomain.com, while the former would then require URLs such as blog1.mydomain.com/blogs and blog2.mydomain.com/blogs. Both of them are obviously too complicated.

    The plugin documentation and assorted blog postings does not seem to answer my doubts.

    Thank you in advance for any assistance.


  36. hello Donncha

    I’ve got a curious issue I was hoping you could help with.

    i set up diet-evolution.com and add as the a name record.

    it forwards to diet-evolution.prestigious-hosting.com just fine.

    however, when I add the domain diet-evolution.com in the domain mapping plugin – it does not resolve and I get an error:

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    it’s not an issue with the a-name, as i’ve had the domain DNS changed on 2 different servers – and get the same result.

    any idea what could be causing this?

    help greatly appreciated! πŸ˜‰ this is a way cool plugin!

  37. Very confused.

    I think I am missing something completely. Is there a clear description of exactly what this plugin is supposed to do? I know what my needs are, and the overview seems to suggest that this plugin will do it, but that is as far as I get.

    For example: is a user supposed to be able to see a blog under its own unique domain, or is this just a redirect tool? Where do I actually link a domain to a specific blog? There are lots of questions around by people using this plugin saying that links do not go where they expect them to, but I cannot find any documentation that describes what is actually supposed to happen, and what links to what.

    Sorry if that is very confused, but I’ve not managed to get this plugin to do anything consistent. If I knew how it was supposed to work, I could report on specific things that may or may not be working.

    — Jason

  38. I think I have figured out what I am missing. The domains cannot be managed from the main admin domain. There is a kind of chicken-and-egg situation here: the blogs for the alternate domains need to be created using sub-domains of the main admin domain first. Then you must log into those blogs (using the sub-domain for access). From there new domains are added (actually, just one domain, as multiple domains do not work out-of-the-box, but watch this space). From that point the sub-domain suddenly stops working and all links change to the alternate domain for that blog. Since the domain changes, you also need to log back in, as the browser needs new cookies.

    If that process goes wrong, then there is no way to fix it from the main admin domain, and there really ought to be. Luckily the database table of domains is not too complex.

    Like I say, watch this space, as I have a few patches to fix some of these issues.

    — Jason

  39. Has anybody had any luck getting the mapped domains to KEEP the www?

    For example:

    http://www.myprimarydomain.com has WPMU installed and running with DonnchaÒ€ℒs domain mapping plugin. I can create


    with no problems. When I point http://www.subdomain1.com to my primary domain and set up the plugin, it works fine except that the website removes the wwws (shows up as subdomain1.com instead of http://www.subdomain1.com)

    How can I keep the wwws as part of the mapped domain name?

  40. Hi – I am having issues with the links not working after I configure the domain mapping for WordPress MU.

    Here’s what my config is:
    1) I installed WordPress MU at the blogs.domain.com subdomain of my site. It’s working fine.
    2) I installed the domain mapping tool. No problem there.
    3) I want to create a new blog called “test”. This creates test.blogs.domain.com. No problem there. I tested all my links (About, test posts, test categories etc.) and they all work fine.
    4) I now want test.domain.com to resolve to test.blogs.domain.com
    5) I set up a domain map in the test.blogs.domain.com dashboard. I add test.domain.com as the domain to map to this particular blog.
    6) I create a CNAME map in my DNS as follows:
    test.domain.com 300 IN CNAME domain.com
    7) It seems to work…when I type test.domain.com in a browser, I get the blog at test.blogs.domain.com. However, when I click on any link, like “comment”, or “About”, the links are broken (not found).

    How do I fix this? Is there something that I need to add to my Apache config file (a VirtualHost directive?), or to the .htaccess (a redirect?)?

    Thanks heaps!

  41. Great stuff – thanks Donncha!

    On the registration page for new-site.com/wp-login.php?action=register , it redirects to wpmu-base-domain.com/wp-signup.php using a completely different theme.

    is it possible to get this to display properly on new-site.com/wp-signup.php?

      1. really not possible? Why?
        That would be an absolute co-criteria for my project πŸ˜‰
        I guess that the users might be very confused when re-directed to another website for signing u…..

        Really no chance? Could you pls clarify a bit?

        Many thanks…



  42. Hi,

    I was just wondering: I only have a few wordpress-mu blogs (literally 2 or 3) – would a custom Apache mod_rewrite rule do the same thing?

    Obviously, for large multi-blog sites this is not feasible, but for me, it would work fine.

  43. Hi, I map 2 domains to a blog. I think the plugin choose the main domain by alphabetic order. Is there any way to select a domain as the main one? Thanks.

  44. Hello all,
    I solved the cookie question in a simply way.. editing the wp-config.php I just commentend out

    #define( ‘DOMAIN_CURRENT_SITE’, ‘www.example.com’ );

    and replaced with


    it’s not very very clear, but I don’t think it would bring problems.
    Any doubt or suggestions?

    Thank you,

  45. Hey Donncha,

    Domain mapping doesn’t appear to work on a virtual host, but the docs say it supports vhost. How do you suggest we set this up, because the domain is resolving to the IP, not the vhost, right now. Is there a trick to this? We have full root access if modifications are necessary in the apache config, maybe a wildcard somewhere?


  46. Hello, I am currently using the Domain Mapping plugin. Its great !! I have domains mapped with both my site IP and CNAMEs. After the domain is mapped, I can completely remove the blog’s created sub domain and doing this helps links on BuddyPress activity to work correctly with a mapped domain. I just change the base, home, and files URLs in the blog’s Options database table. Good to go.

    Any ideas how to completely bypass the sub domain registration and create the blog domain mapped ?

    Thanks !!

Leave a Reply