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.

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 🙂

  11. Works great on my new MU project. Though not having to be activated threw me off, until I re-read the docs.

    Email me if you want to know how I enabled it on Plesk.

    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?

  12. 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??

  13. 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.

  14. 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?

  15. 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.

  16. 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!

  17. Richard – I presume it will, just point your xmlrpc client at the new domain and the server should know what blog you’re looking for.

  18. @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.

  19. 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.

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

    My site has URLs like:
    username1.blog.ourdomain.com
    username2.blog.ourdomain.com

    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:

    http://blog.ourdomain.com/wp-signup.php?new=new-domain

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

    Or any ideas what I’m doing wrong?

  21. 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.

  22. 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…

  23. 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 ?

    thx

  24. 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! 😉

  25. 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.

  26. 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
    myblog.com/wp-login.php?action=logout

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

  27. 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.

  28. 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.

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close