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.


Discover more from Something Odd!

Subscribe to get the latest posts to your email.

82 thoughts on “WordPress MU Domain Mapping 0.1

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

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

  3. Andrea to the rescue with a solution here by editing the blog address under Site Admin. Works for me.
    http://mu.wordpress.org/forums/topic.php?id=9790

    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.

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

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

  6. 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:

    http://wordpress.org/support/topic/219138

    I’ll update that post as I can…

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

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

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

    Albert

  10. hello Donncha

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

    i set up diet-evolution.com and add 85.10.212.250 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!

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

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

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

    subdomain1.myprimarydomain.com

    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?

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

    Question:
    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!

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

        Merci

        Markus

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

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

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

    define( ‘DOMAIN_CURRENT_SITE’, $_SERVER[‘SERVER_NAME’] );

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

    Thank you,
    Carlo

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

    Thanks

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