How to Domain Map with WordPress Mu

So recently I had to implement 2 sets of sites using WordPress Mu (multi-user) and one of the requirements (for both sites) was to be able to domain map the sub-sites, much like you can do on WordPress.com for a fee. So I went about prototyping this and managed to get it working!

So I thought I would share my joy with a quick guide, because it was great to see it actually work!

What do you need…

<!–
document.write('’);
//–>


Requirements:

  • WordPress Mu – if you dont know how to install it – check out Sarah Gooding’s great tutorial here
  • Domain Mapping Plugin
  • Access to the WordPress Mu install files on your hosting via FTP or File Manager (whatever,a s long as you can edit the code!)
  • A hosting provider that is willing to make apache changes – critical to success – I had the privilege of working with RSAWEB on these projects but also confirmed with Serve Hosting that they can do it as well (although I havent tried it with them yet).

Just tell me how already!

  • Install WordPress Mu
  • Make sure Subdomains have been chosen as the blog option during install – needs wildcard DNS for this
  • Download and extract the WordPress Domain Mapping Plugin
  • Upload the sunrise.php file into your wp-content folder
  • Upload the domain_mapping.php file into your wp-content/mu-plugins folder
  • Now…edit your wp-config.php file in the document root of your site
  • Find the line that says define( 'SUNRISE', 'on' ); and uncomment it – add it if it isnt in the file
  • Dont forget to save your edited wp-config.php file
  • Activate the Domain Mapping Plugin on the main WordPress Mu site backend
  • Go to the Domain Mapping Plugin section in the main site backend
  • Enter the IP for the main site in the Server IP Address field as example below
  • domain mapping 1
  • If you dont know how to get the IP – you can ping the domain by going into the command prompt (if you’re working in windows) and type “ping mydomain.com”
  • Now go to the sub blog backend that you want to domain map
  • Activate the Domain Mapping Plugin
  • Go to the Domain Mapping Plugin section in the sub blog backend
  • Enter the domain that you want to map to the sub blog in the Add new domain field until it appears under the Active domains on this blog
  • domain mapping 2
  • Now – you need to notify your hosting provider that they need to get Apache to catch the domain and point it at the same document root of the main site domain – ie the document root of your WordPress Mu install
  • Usually this involves them doing one of 2 things – editing the vhost and/or editing the A records/CNAME records – they ‘should’ know what to do though
  • Once the above has been done, all should be working great and you can view your sub blog at the new domain just like a regular WordPress site but on one code base!

Warning : Things can go pear shaped very quickly if you are not careful – the first time I did this I almost broke the entire install – not good if you are doing client work on a live site – don’t go editing database records; you can get it done that way but I don’t recommend it because your upgrading functionality becomes obsolete.

15 responses

  1. Quick correction: if you’ve uploaded the plugin to the mu-plugins folder, you won’t need to activate it. It won’t be on the Plugins list, but it will be running all the time. (Recommended in this case.)

    And in addition, the users will then have to “park” their domain to your install. If the site answers to the main IP address, changing their A records to your IP will do it.

    I did a write-up here too – http://wpwebhost.com/using-multiple-domains-with-wordpress-mu/

    1. @Andrea_R Cool – thanks for the tip! I will be sure to try this, fortunately on those 2 projects the client wont handle their domain 🙂

  2. Great tutorial! Probably one of the clearest guides I’ve seen on this topic.

    I have done this before a couple times and it’s very cool, but you’re right it’s very “breakable”. One problem I have is as to whether it’s possible to automate the task of “parking” domains on the server.

    The method I’ve found success with is to setup a *.mydomain.com record in subdomain. This allows for wpmu installs. Once a person decides to use domain mapping, though, I have found that I had to manually add the new domain as a “parked domain” through cpanel on the server. Perhaps this is what you are referring to in your final steps: “Usually this involves them doing one of 2 things – editing the vhost and/or editing the A records/CNAME records – they ’should’ know what to do though”

    Any further guidance you can give would be much appreciated. Thanks again!

    1. Thanks James – yeah the last step would be to edit the vhost or the A records depending on if you use dedicated hosting or shared hosting. I’m also not sure on how to automate that process yet (possibly through a script if using dedicated hosting) and have been doing the parking manually, but if I do figure it out I will be sure to post it!

  3. @jeffkus – there are some ways to tweak the server if you’re on a vps or dedicated, so it will catch any domain pointed at it and send it to WPMU. Then MU will handle it.

    I’ll be covering this in my second session this Saturday at WordCamp NYC. 😀

  4. Hey Jeffikus,

    thanks for the response. I’m on shared hosting at the moment, so manually’s the only way to go for me right now. Know any hiccups with moving to a vps or dedicated server for wpmu?

    @Andrea_R go ahead and rub it in that I can’t be there! if it comes to Miami in the next year will you be able to make the trip??? Any chance of catching a video of your session online at some point in the future?

  5. Hello i hew truble with this.
    Can i us this plugin in shared Host?
    If yes pls can you help my.

    This domain http://www.ploteso.com is pointet on my ip adress with i ad on admin panel.
    I ad that domain name 2 the design.shqipress.com somthing its wrong
    its not working wat is problem
    i edit files wp_confi…. im not soure wat next
    Or i nead 2 spik with my hosting company!
    Pls can you ad my email 2 contact me
    Sory 4 my lang…..

    1. Howdy, dropped you an email – give me a shout if you still struggling.

  6. […] The trouble begins with the concept of MultiUser.  As installed, WPMU, does not provide for multiple blogs. Fortunately for us, a WordPress plugin named WordPress MU Domain Mapping was written by Donncha O Caoimh (the name of his blog is Holy Shmoly!) and commented on quite well by many including Andrea Rennick and Jeffrey Pearce aka Jeffikus. […]

  7. […] The trouble begins with the concept of MultiUser. As installed, WPMU, does not provide for multiple blogs. Fortunately for us, a WordPress plugin named WordPress MU Domain Mapping was written by Donncha O Caoimh (the name of his blog is Holy Shmoly!) and commented on quite well by many including Andrea Rennick and Jeffrey Pearce aka Jeffikus. […]

  8. When I mapped a domain to the subdomain, the browser reported a loop error.

    I can only get the “subdomain.domain.com” to appear.

    Using hostgator, there’s no CNAME tool in cpanel.

    tech support created an “Add on domain”, then a 301 redirect. None of this is in your instructions, but thats what tech support did.

    Instructions are confusing as they are generic without reference to the hosting provider understandably.

    Any ideas?

  9. Rodney Avatar
    Rodney

    Thanks Jeffikus! 🙂

    Your instructions were much clearer than others I’ve found. Andreas are poorly written & confusing at best.

    Cheers!

    1. thanks Rodney!

  10. Stewart Avatar
    Stewart

    Yeah, Ditto – straight to the point! 🙂

    I had to set up vhosts in Apache2 (ie: brute-force!) to get this plugin working and would love some insight on how to delegate this task to the WordPress Domain Mapping plugin.

  11. Tony Zeoli Avatar
    Tony Zeoli

    Trying to get Domain Mapping working, but getting a message that says will only work if site is located at “/” or the top level directory. I’m working in /var/www/wordpress/. If apache is set to /var/www/ as the public directory, then I should move WordPress into it, I’m assuming, and have it reside in the top level, right?

    Tony

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.