WordPress MU Domain Mapping 0.5

WordPress MU Domain Mapping is a plugin that allows the users of a WordPress MU site to use custom domains on their blogs.

It’s been a while since the last release but with the help of Ron Rennick, and many others (kgraeme – you kick ass at finding bugs!) I think the wait has been worth it. Changes since the last release:

  1. Works in VHOST or folder based installs now.
  2. Remote login added.
  3. Admin backend redirects to mapped domain by default but can redirect to original blog url.
  4. Domain redirect can be 301 or 302.
  5. List multiple mapped domains on site admin blogs page if mapped
  6. Bug fixes: set blogid of the current site’s main blog in $currentsite
  7. Bug fixes: cache domain maps correctly, blogid, not blog_id in $wpdb.
  8. and lots more bugs fixed and squashed.

There are still a few limitations however:

  1. Your WordPress MU site should be installed in the root of your server.
  2. It’s not possible to map a path on the new domain.
  3. You cannot map a domain on to the main blog in a folder install of WordPress MU.

Grab it from the page above, make sure you read the readme.txt as the plugin needs to be installed and configured correctly. You’ll also need to be familiar with concepts such as CNAME and A DNS records and how to configure your server correctly.

Please try it first on a test server. We have gone to extraordinary lengths to try to fix every bug we could but it’s always better to be careful when trying out new software.

Comments

comments

117 Replies to “WordPress MU Domain Mapping 0.5”

  1. I’m having this same problem that R McKenzie and Donncha have been discussing. I actually had posted over in the plugin forum prior to reading this exchange.

    Fixing it is beyond my skill set unfortunately, but I’d be happy to use what I’m running to test potential fixes.

  2. Hello,

    I just wanted to add that I had the very same problem…

    And checking the infamous “Redirect administration pages to original blog’s domain” option did the trick!

    Now I’m a happy WPMU/Domain Mapping user 🙂

    Donncha et all, thanks a lot!

    All best,
    Will

  3. Hi Donncha,

    Thanks for this wonderful plugin. Even as a newbie I have been able to get it up and running for ten sites and they all depend on it to have their domains on the web.

    But my sites’ editors also need another plugin, “TinyMCE Advanced” in order to add tables in WYSIWYG without using HTML. It does not fully work unless we disable the MU Domain Mapping plugin v 0.5.1 . We are using TinyMCE Advanced plugin v 3.2.7 in both Firefox and Safari.

    In TinyMCE Advanced, the bug is when you click on a table icon or other icon that brings up a popup. Then the popup is blank so you can’t use it to make tables for example. Deactivate the WordPress MU Domain Plugin and the issue goes away.

    If I replace TinyMCE Advanced with MCE Table Buttons I have the same behavior.

    Do you have any idea why Domain Mapping .5.1 might conflict with the functionality of these two MCE Plugins, and what we might do.

    Thanks for any help or ideas!
    Thom

  4. Is there any way to disable the remote login? Having it redirect me to a different domain for login is breaking my alternate authentication methods (Facebook and Twitter). Both of these methods rely on redirecting to somewhere else to authenticate, then using a cross-domain receiver to set cookies which then authenticate me to the site. If the login is on the wrong domain, then the cookies can’t be set by the returning code.

    Basically I’ve got ottodestruct.com and ottodestruct.com/op/. I mapped the op to ottopress.com. Now I need ottopress.com/wp-login.php to actually work and not redirect me to ottodestruct.com/op/wp-login.php instead, otherwise the Facebook and Twitter receivers can’t work.

    I don’t much care if this breaks my single-login capabilities, I prefer to have my one-click login capabilities.

    Using WordPress 3.0 Beta 1.

  5. @ Will Castillo. Thank you! That was remarkably simple.

    I’m still curious to learn how the domain mapping can be accomplished for the admin so it doesn’t go to a subdomain, but for this particular project, I could care less.

    Thanks again.

  6. Hello, just wanted to know why do i have conflict in login. I’m using wordpress mu + buddypress. I really had hard time figuring whats happening I can login but when I vist the site then accessing wp-admin again it require me to login again. Please me help. Thanks! Btw great plugin!

  7. @Thom,

    My guess is that the TinyMCE Advanced plugin uses WP_PLUGIN_URL and that is not pointing to the same domain as you have in the address bar of your browser when creating/editing a post. You’ll then get a cross-domain JavaScript error which is probably why that plugin does not work when the domain mapping plugin is also installed.

    @Donncha,

    Have you seen behaviour like this before? Should WP_PLUGIN_URL get updated to reflect the mapped domain?

  8. Having the same problem Jak had “I replaced the old sunrise.php and domain_mapping.php – now all that shows up is a blank page” This is a new install. If I delete domain_mapping.php the admin site seems to work fine, but when I try to log into any blog other than my primary when I put in admin and my password, it just keeps coming back to the login in screen with no errors. I’m pretty new and clueless at this, so thanks for any help.

  9. You can modify tinymce-advanced a little bit. You should use different constant for pluging path than WP_PLUGIN_URL.

    You could do something like that in the start of the file:
    $plugpath = WP_PLUGIN_URL . ‘/tinymce-advanced/mce/’;
    if(function_exists(“domain_mapping_post_content”))
    $plugpath = domain_mapping_post_content($plugpath);

    define(“REAL_PLUGPATH”, $plugpath);

    then search and replace.

  10. Had the same issue and spent the day nutting this out. Tried the above Jazmo detailed but couldn’t get it to work so looked a little deeper into it.

    There’s an even simpler solution that I got to work and its to replace line 233 of tinymce-advanced.php

    $plugpath = WP_PLUGIN_URL . ‘/tinymce-advanced/mce/’;

    with

    $plugpath = $blog_url . ‘/wp-content/plugins/tinymce-advanced/mce/’;

    I can now add tables/images without getting blank popup windows.

    Works only with 3.2.7

  11. Hi! I’ve just installed the domain mapping plugin – and it works great! Thanks!

    The only issue I have is with user registrations. Scenario:

    1. my site is at maindomain.net
    2. I create a subdomain blog and map it to mappeddomain.net
    3. someone visits mappeddomain.net and try to register (as a subscriber), by using the link http://mappeddomain.net/wp-login.php?action=register from the “meta widget”

    What happens here is that the user first is redirected to mappeddomain.net/signup.php, and then immediately to maindomain.net/signup.php, which is a completely diffferent blog – different look, and of course, different domain name, which would be very confusing to users.

    Additionally, in the mail you get when you register, the link supplied is to maindomain.net… And the user is not even added to the blog at mappeddomain.net, so when he tries to log in, he gets a page telling him “You don’t have permission to view this site. Please contact the system administrator.”

    Any thoughts on this?

  12. I have some plugins that use the WP_CONTENT_URL constant to output css or js locations.
    This constant is defined in wp-settings.php prior to loading the plugins and is initialized with the siteurl option value.
    The output from these plugins is the url of my subdomains instead of the mapped TLD.
    For example: http://subdomain.mydomain.com/wp-content/plugins/someplugin/thecss.css instead of
    http://mymappeddomain.com/wp-content/plugins/someplugin/thecss.css
    Is there a fix or a workaround? I prefer if all absolute urls on the website will include the domain the surfer is really visiting

  13. Hi again Donncha,

    I have been coding a new multisite plugin (mu-plugins) extension to my own setup and I have some compatibility issues with the current version of the Domain Mapping plugin.

    It was fantastic that you added my CNAME and hook additions earlier this year and was wondering if you could add another tiny modification?

    I suppose my additions _should_ be considered undocumented due to their nature, but I need to disable:
    define( 'COOKIE_DOMAIN', $_SERVER[ 'HTTP_HOST' ] );
    Within sunrise.php.

    Basically it would involve defining a force override in wp-config.php.

    Again, this should not be used by most people but my plugin requires it (and it all works with the modifications – hence a force override).

    For anyone curious about what my mu-plugin does:

    Scenario – You have multiple networks (so a user can create theirblog.site1.com, theirblog.site2.com etc) and you have a SSL certificate for your main site.
    You would like your users to login using the SSL certificate you managed to get for your main site (SSL certificates are usually cheaper for single domains and StartCom LTD provides these basic certificates for free for one domain and a subdomain which are valid on most browsers).
    Your users can setup their own domain mapping but still login over HTTPS on your main site.
    If a user has multiple blogs and is already logged in on the main site, regardless of domain mapping or whatever network domain the user has, then a simple click of ‘login’ or visiting wp-admin will instantly validate you (with strict checking) and instantly log you in without supplying credentials.

    Donncha – I cannot remember how I last submitted code but the changes are only a few lines and do not alter any current workings (unless the force override is set), can you please point me in the right direction yet again?

    Many thanks!

  14. HELP! Where can I download the old version? The old one worked like a charme, but the new one doesn’t work!!! (“Please edit your /www/htdocs/w00d0936/jesusde/wordpress/wp-config.php and move the line define( ‘SUNRISE’, ‘on’ ); above the last require_once() in that file.” > But it IS above it!)

    And these are live blogs! What a shit! 👿

      1. No I didn’t in the first place, then i tried that and it worked *puh*… But that should be stated somewhere big and fat!

        Thank you for the tip anyway! 😎

          1. Good idea! You could add this to the aboe error message, too – that would have had helped me most, i think. Thank you 🙂

  15. Is it possible to use a subdomain for my mapped TLD? Say that blog1.example.com is mapped to http://www.myexample.com and I’d like images.myexample.com to also be usable. Is that possible at all using the plugin?
    If it’s possible, what’s the right procedure to accomplish this behaviour?

    1. Not really. You could map images… to your blog but then you have to deal with potential duplicate content issues.

      You could just rewrite all your image urls to the new url and as long as there was a wildcard dns pointing at the right Apache VHOST it’ll serve the right file, maybe.

      1. Thank you for the quick reply.
        My current problem is that if I add a subdomain on cPanel it’ll let wpmu handle the request. This is what I want because wordpress does all the /files/… to wp-content/blogs/… translation but wpmu won’t find the blog with the images prefix. I could just change the upload dir in settings but I want multiple images subdomains so that won’t work either.
        Do you have any idea how I can solve this problem?
        After this is solved I think that all I have to do is rewrite the urls in .htaccess and add a filter to translate existing images’ url to the new subdomains.

  16. Hi Donncha,

    Was there any advice that was appropriate to the issue David mentioned, where on selecting Preview Post from within the Edit Post screen, it returns a 404 error.

    I actually see this on some browsers, but not others, strangely. It doesn’t happen on a non-domain mapped version of the site.

    Thanks in advance,

    Dan

  17. Hi All,

    I help manage quite a few sites on Multi Site with Domain Mapping. And while the plugin itself is invaluable the preview bug is quite a nuisance for our clients.

    Is there a plan to address this? Or have I missed the fix?

    Thanks!
    -b

  18. Are there plans to fix this? I just set up a WP 3.5.2 MU system from scratch, on a virtualized linux instance in EC2. I had the log-in loop problem even before installing the MU domain mappint plugin. The fix prior to that had been to include the define(COOKIE) directive. That fixed it, but after installing MU domain mapping, the plugin makes me comment out that line. Now I’m back to the same problem. Can’t log into non-primary sites. This thread seems to have gone dormant. Put the problem persists as evidenced by my fresh “from-scratch” setup.

Leave a Reply