WordPress Multisite Domain Mapping
The WordPress Multisite feature has been with us since the 3.0 version was first released. It’s been used for many different purposes such as splitting one site into multiple subsites sites and multi-language implementation etc. In this post I’ll show you how you can use that same WordPress Multisite feature to create a single WordPress multisite instance. This you can then use to manage sites on completely different domains. Interested? Read on.Let’s say you have a company named “Acme” that sells 2 products. You wish to create a company site along with two sub sites for 2 different products that you sell. By using the WordPress Multisite feature you can create a site network in which you’ll be able to add new sites or update existing ones from a single administration area. Since the WordPress network allows us to add sites in a form of “subfolders” or “subdomains” we’ll need to use a plugin called WordPress MU Domain Mapping to map sub sites to different domains.
Before we begin you should get familiar with the WordPress Multisite concept and how it works since we won’t be explaining how to create a network in detail. Also you’ll need to create “Acme” multisite instance in order to follow along with the tutorial. For instructions on how to make your WordPress instance a multisite you can check out is official WordPress documentation.
Now let’s create 2 new sub sites for our 2 cool products within our new WordPress multisite instance. To do so we’ll need to login into the “Acme” WordPress administration area and then click on “Sites” within the “Network Administration” area. Now we need to click “Add new” fill in the site address, title and admin email (make it your own) and then click the “Add Site” button. Repeat this process one more time just with a different site address and title.
Our new multisite instance is now ready for domain mapping. If everything has gone OK our “Acme Watch” should be accessible via the http://localhost/acme-watch (or similar) URL.
WordPress MU Domain Mapping is created and maintained by Donncha O Caoimh (works at automatic) and Ron Rennick both of whom are major WordPress contributors. Since this plugin is a little bit more specific it needs to be downloaded and installed manually. Instructions on how to install the plugin can be found on the official plugin installation guide.
Now let’s map our two domains to our two new sub sites. To do so we’ll need to go to “Network Administration” page and then click on “Settings > Domains”. Let’s now fill in all of the required data. Be sure to fill in the correct Site ID. The Site ID can be found when hovering over a sub site URL in the “Sites” administration area and looking into a URL to which the link leads to (URL contains an ID at the end). Equally repeat this process for the second sub site.
Our two domains are now mapped and all we need to do now is point our domains to the server IP address. If you’re working on a real site with real domains you should now go to the DNS settings for your domain and point it to the IP of the server on which the site is hosted on. If you’re working locally and you just want to test this functionality you should open your hosts file and add 2 new records to it. The location of the file depends on the OS you are using.
After you’ve saved the hosts file you should see your site appear on the acme-watch.com domain. If you’ve just pointed a real domain you may have to wait up to 24 hours for your site to appear.
This plugin also has few extra customization options that you can use to customize the domain mapping behaviour a little bit more. You can read more about those options in the “Configuration” part of the official plugin documentation.
That’s it. If you’ve enjoyed this post and found it useful, I’d love to hear your comments and your take on WordPress Multisite Domain Mapping.