Domain Mapping For WPMU That Makes Sense

Donncha’s new Domain Mapping plugin for WordPress MU is a wonderful plugin that WPMU users have long salivated for since WordPress.com introduced the feature almost a year ago. Donncha, for those who don’t know, is Automattic’s primary (translation: only) WPMU developer and is amazing at rolling features from the WordPress standalone and WordPress.com into the WPMU code base.

So how good is this new plugin? It’s damn good. It simplifies a process that used to take no less than 30+ steps to accomplish! The plugin does not render the XML-RPC useless unlike the old hack did! It was definitely not plug-n-play, or even pretty for that matter. So here’s a step-by-step setup for those who don’t quite know how to use the new plugin.

How Do I Install The Domain Mapping Plugin?

  1. Login into the domain name’s control panel (this is different than your website’s cpanel) and change the DNS to reflect your name servers of our server. In my case, it would be
    NS1.bui4ever.com
    NS2.bui4ever.com

    Please note that if this is an existing domain, it may take 24-72 hours for the DNS to propagate. If it’s a new domain name that you just purchased, it will happen very quickly.

  2. Download the Domain Mapping plugin from the WordPress Plugins Directory.
  3. Unzip the file and upload the sunrise.php file to the /wp-content/ folder. Copy domain_mapping.php into the /wp-content/mu-plugins/ folder.
  4. Open your wp-config.php file and look for
    // uncomment this to enable wp-content/sunrise.php support
    ;define( 'SUNRISE', 'on' );

    and remove the “;” at the very beginning of define to uncomment the code. If you do not see the line of code in your wp-config.php, it’s OK, just write it in right under

    define ('WPLANG','');

    and save it.

  5. Please note, you have to have Site Admin privileges to use this plugin. Now in most cases, it makes no sense to domain map a domain.tld blog (your main blog) unless you want to change the domain name. The beauty of this plugin is that if you domain map a domain.tld blog, it will redirect traffic automatically with the new mapped domain name in the URL. To domain map an already created (or a domain.tld blog), go to your Dashboard of the blog that you want to domain map (don’t visit the domain.tld when you are intending to map subdomain.domain.tld), select Tools, and select Domain Mapping.
  6. Where it says Server IP Address, you want to enter your the IP address of your server. You can find this out by opening a command prompt (Windows) or a terminal (Mac & Linux) and typing
    ping bui4ever.com

    That will produce the IP address. Enter that IP address and click Save. Under Add new domain, put in the domain name that you wish to be mapped to this blog. Click Add. (If you read the notes underneath the Add new domain, you’ll see that you can do what CNN does with their blogs like the Political Ticker. By using CNAME, WordPress.com is able to host http://politicalticker.blogs.cnn.com/ and CNN would host CNN.com. If you want to do something like that, login in to your domain name that you want to create a virtual subdomain (physical subdomains would be created in your CPANEL which would result in a physical directory on your server whereas a virtual subdomain is merely an aliases) at GoDaddy, Yahoo, or wherever your domain name registar is. I use GoDaddy, so your steps may vary, but I go to my Domain Manager, selct the domain name I wish to add a CNAME to (let’s say in this case, BuiPhotography.com) and click on it to edit. Inside in the middle upper column, under Total DNS, I click Total DNS Control and MX Records. Under CNAMES (Aliases), I click Add New CNAME Record. Under Enter Alias Name, I put blog in the field because that’s the new virtual subdomain I wish to create. Under Points To Host Name:, I put in the server IP address of my server that hosts the WPMU installation where my blog resides. Leave TTL to an hour. It may take anywhere from 5 minutes to 3 days to resolve before you can use the newly created virtual subdomain. Once it does resolve, you need to login into your CPANEL and park the subdomain (blog.buiphotography.com). Once parked, now login into your blog you wish to domain map (http://buiphotography.bui4ever.com) and go to Tools > Domain Mapping and enter in blog.buiphotography.com and it should start working! Cool huh?

  7. After you save, you will notice that the new URL is resolving with the new domain mapping meaning that subdomain.domain.tld should now resolve as domain.tld and if you try to visit subdomain.domain.tld, it should automatically rewrite it as domain.tld.
  8. If you wish to undo the process, log back into the Dashboard > Manage > Domain Mapping and delete the entry.

Absolutely amazing.

[UPDATE: So one of the major things I noticed is that with the Domain Mapping plugin, you can no longer create subdomain blogs of mapped domains. With Dr. Mike’s domain mapping method, a newly mapped domain had the ability to create subdomain.domain.tld just like the main site. For some people, this could be a drawback and for others, it doesn’t matter, but it’s worth noting.]

22 thoughts on “Domain Mapping For WPMU That Makes Sense”

  1. Not being able to create “sub domains” off the mapped domain is a bonus IMO, because this plugin isn’t supposed to create multiple WordPress MU sites. It’s only for mapping blogs.

    Thanks for the positive write up!

  2. Originally Posted By Donncha O CaoimhNot being able to create “sub domains” off the mapped domain is a bonus IMO, because this plugin isn’t supposed to create multiple WordPress MU sites. It’s only for mapping blogs.

    Thanks for the positive write up!

    Donncha – I understand. It was a feature that I had kinda liked because it opened WPMU up to a whole new level. But I like your plugin much more because it retains the ability for remote publishing (XML-RPC) that was lost with the other domain mapping method.

    Thank you for your commitment in the WPMU project! I’m positive you’ll win the 2008 WordPress MU Plugin Competition even if there was 100 submissions :).

  3. I just installed the plugin and after a bit of flumbling it appears to be working very well! Thanks!

    Just one question, where I’m not sure to post. I’ve successfully mapped several domains, but one is not working. When I try and map this particular domain the page refreshes with nothing added; i.e. no button with the added/mapped domain.

    This domain was used in setting up the server. There are no DNS or /etc/host entries. However, the domain is still in use by postfix.

    Any help would be appreciated!

    Thanks.

  4. Originally Posted By JohnI just installed the plugin and after a bit of flumbling it appears to be working very well! Thanks!

    Just one question, where I’m not sure to post. I’ve successfully mapped several domains, but one is not working. When I try and map this particular domain the page refreshes with nothing added; i.e. no button with the added/mapped domain.

    This domain was used in setting up the server. There are no DNS or /etc/host entries. However, the domain is still in use by postfix.

    Any help would be appreciated!

    Thanks.

    Answered my own question. I found a dup entry in the wp_domain_mapping table – after it was deleted I could recreate np.

    Thanks again!

  5. All is working very well. I’ve been searching for a way to update welcome e-mails with the newly created mapped domain name. Is there a variable which can be used for this or will I need to update the default welcome messages upon each new blog creation?

    Thanks for any ideas.

  6. @John – John under Site Admin > Options > Welcome Email, does it say something like:

    Dear User,

    Your new SITE_NAME blog has been successfully set up at:
    BLOG_URL…

    SITE_NAME is all you need for each person signing up for a subdomain on a newly created blog will get. Please note that this will not quite work like how you want if you use Donncha’s plugin. You have to manually map the domain for it to properly show.

  7. Ran into another problem – unfortunately. I can’t add media using the “add media” flash interface. Is the domain mapper possibly interfering, or could this be something else? The flash screen loads and I can paste my link or browse for a file, but once I submit, the login screen appears and nothing is uploaded. Thanks.

  8. Originally Posted By JohnRan into another problem – unfortunately. I can’t add media using the “add media” flash interface. Is the domain mapper possibly interfering, or could this be something else? The flash screen loads and I can paste my link or browse for a file, but once I submit, the login screen appears and nothing is uploaded. Thanks.

    Please read this.

  9. I would like to thank you for the writeup as I was a bit confused with the way in which the plugin works…. I just have a simple redirect issue with some of the BP features….

    great plugin which gives me another option for my users

  10. I’ve setup the domain mapping plugin but I’ve noticed that i cannot ‘logout’ of the blog.

    I get a WordPress failure notice page saying ‘You are attempting to log out of myblog’. Please try again.

    If I click on ‘Please try agian’ it just takes me back into the blogs Dashboard.

    I don’t know where I should start looking for a solution.
    Hope someone can guide me.
    Thanks.

  11. thanks James,
    I’ll go through that forum link.
    However my wordpress installation works fine without the Domain Mappings plugin, both login and logout.

    Once I have Domain mappings installed and enabled, the logout stops working.

    I will give this a go again. as its a new install I’ll start from scratch again. will report back if I still have issues.

    thanks

  12. Quick Question…
    When using this plugin, can I use a different dedicated IP address for each mapped domain? Some of the sites I plan to use will require a dedicated IP address for SSL certificates. As long as all of the different IP addresses are located on the same server, will this still work?
    Thanks,
    Ed

  13. @Ed – The way I understand it is, no. The IP you enter into the domain mapping plugin has to be the main site’s IP.

    On the other hand, I’m not 100% sure about different IP addresses on the same server. You can give it a try, but I don’t think it will work.

  14. Hi Richard,
    I can’t find “Manage – Domain Mapping”. It doesn’t show up on my admin dashboard. Any clue?
    Thanks

  15. Thanks Richard,
    I found it, I think Donncha needs to update the info at the wordpress website 🙂
    Another thing, I’ve read everywhere, it seems quite easy to apply the plugin but I just can’t make it work. I use VPS with lxadmin/kloxo as a control panel. It’s pretty similar to cpanel. But everytime I park or add domain (xyz.com) under the main domain for wordpress MU (abc.com), the blog domain (xyz.com/xyz.abc.com) will lead to the kloxo default page and I can’t access the blog anymore. Have any ideas?
    Thanks

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

Leave a Reply

Your email address will not be published. Required fields are marked *