How to set up Multisite Domain Mapping in WordPress 3.0

October 19, 2011 · 121 comments

by Dustin Betonio

image

I recently wrote an article about how to use WordPress 3.0 multisite/network features. This feature is really cool but out of the box it only supports the multiple sites/blogs to be served on the same domain (networksite1.domain.com or www.domain.com/multisite1/). For some this may be fine but really most like you want to have unique domains for each individual site. In this article I provide a quick guide on how to set up multisite domain mapping in WordPress 3.0. Please note that you should not follow this tutorial if your WordPress 3.0 has not been configured to support multisites!


ElegantThemes
ThemeForest

Advertisement
Before you do any mapping, you need to work with your host to make sure that the domains in question all point to the primary domain. In other words, let say your primary domain is [a].com and you want to map [b].com to the WordPress served on [a].com. Before you start this guide it is a pre-requisite that you have set up the DNS-records for [b].com. There is a short guide at the end of this article if you need assistance on DNS-configuration but you can also consult your hosting provider as needed. After all the DNS-configuration needed for this to work is quite basic if you know how DNS work.

The plugin is what later separates them out into the separate sites, but to do that, the domain needs to send you to the WP site in the first place. For this tutorial, we will be using the WordPress MU Domain Mapping plugin.  This plugin allows users of a WordPress MU site or WordPress 3.0 network to map their blog/site to another domain.

Guide for setting up Domain Mapping

Step 1: Manual Plugin Installation

The Domain Mapping plugin is unlike most other plugins as you are not going to install it the traditional way using Plugins->Add New menu. It is a bit more complicated and you need to update configuration files manually and FTP access to update the files on your server.

Start now with downloading the plugin here. The plugin consist of two files that you need to put in the proper places. In WordPress 3.0 the wp-content/mu-plugins folder doesn’t exist – you need to create it. The first file to be uploaded is the domain_mapping.php file. This needs to go into the mu-plugins folder you just created.

image

The second file is the sunrise.php file and you need to upload it to the wp-content folder.

image

Step 2: Activate Sunrise

You need to edit your wp-config.php file placed in the WordPress root folder. In wp-config.php uncomment the SUNRISE definition line: define( ‘SUNRISE’, ‘on’ ); If this line does not exist, paste it in. (if you face any trouble at this stage check to make sure your apostrophes ( ‘ ‘ ) in the pasted code are the same type as the apostrophes in the rest of your wp-config.php file. If not you need to manually chance them in the pasted code.

This will cause WordPress to go load that sunrise.php file and use it, however if you have not installed the network features of WordPress this is where things will go wrong!

Step 3: Server info

Domain Mapping has now been installed and next you have to set up the basic configuration. Go to your main domain’s admin page and log in as an administrator. Then go to the new Super Admin->Domain Mapping menu.

image

There are two main options to choose from here. You can either put in the IP address of your server (as defined in your domain’s main A record) or you can put in a CNAME that points to your server. The IP address is what I would recommend you to use. If you are not sure about your IP-address you simply have to ping your domain. On Windows open a command window and write “ping <domain name>”. The instructions on the page are pretty good read them carefully.

Other options on this page:

  • Remote Login – This will make your login pages for all sites redirect to your main site to do the actual login. The benefit of this is that when you log in to one, you log into all of them. The downside is that the URL changes to another domain in order to log in.
  • Permanent redirect (better for your blogger’s pagerank) – This makes your subdomain or subdirectory sites redirect to their domains. You should leave this on.
  • User domain mapping page – Turn this on if you want users to be able to put in their own domains for mapping.
  • Redirect administration pages to blog’s original domain (remote login disabled if redirect disabled) – This makes all admin pages show up on the original domain instead of on the new domains. You need this enabled for remote login to work.

Step 4: Mapping the Domain

Before you can actually take a new domain into use on a multisite you need to do some configuration up front. When you purchase a new domain, you will need to update its DNS settings to actually point to the WordPress server IP or CNAME. On some hosting plans this is easy and there are good instructions on how to set it up. On others you may need to ask support to get assistance. I use a pure DNS hosting provider (separate to my web hosting) where I have full control of the DNS settings and setting up a new A Record is pretty simple. I have also tried it on smaller hosting solutions using their own home made software and here I found this kind of task really though. You may need to be patient because some domain updates takes quite some time to replicate to the many DNS servers on the Internet. This is controlled by TTL on the record and you my want to lover it to 10 min. when you are playing with the domain settings. There is a guide below on how to do this if you have cpanel.

There’s two ways you can actually map a domain to one of your sites. The user screen is the simplest way, if you left that option on before. Log into the site you actually want to map to a new domain. Easiest way to do this is clicking Super Admin->site->Backend.

image

Then go to Tools->Domain Mapping. What you need to do is to put in the domain name, set it as the primary and press add.

image

You need to be aware that if you didn’t get the domain (in the example testsite.com) pointed correctly to your WordPress server before doing this, then your site will not be accessible. So make sure that your domain is ready before doing this. If you in step 3 selected the fourth checkbox about redirecting admin pages to the main domain you will still be able to access the admin area for the site.

The other way to set domain mapping is through the Super Admin->Domains menu. Here you’ll find a list of sites and their ID numbers and you can map an id number to a domain name here.

image

The Tools approach found under the multisite is a simpler to use, but the super user version will allow you to map domains without visiting each site. You can also correct broken domain mappings from here.

Step 5: Seeing the Mapped Domains

After setting up the domain for a network site you will see that the domain mapping (column at the right) is shown in the sites listing. Go to Super Admin->Sites.

image

When you get this result your network site has been configured with a domain and is ready to use!

DNS Guide For Cpanel users

If your domain uses the name servers on your hosting account you should follow these instructions. If the nameservers are elsewhere change the A record or CNAME as documented above. Add a wildcard subdomain/virtual host record to your site’s DNS record in Web Host Manager (WHM). If you do not have access to WHM, you must email your web host and ask them to make this one change for you. Should be no problem:

  • Go to “Edit DNS Zone” and select the domain of your WPMU installation and click “Edit”.
  • Below “Add New Entries Below This Line”, enter in the first box (Domain) an asterisk: “*”.
  • The second box, TTL, should be “14400″.
  • The third box should be “IN”.
  • Select A Record Type from the drop down “A”.
  • And in the last box, paste in the IP address of your website/network.

From Cpanel, click on the “Parked Domains” under the “Domains” section:

  • Under “Create a New Parked Domain” enter the domain name you want to add to your network.
  • Click the “Add Domain” button.
  • It should add the domain to the list of parked domains and under “Redirect to” it will say “not redirected”. That is OKAY.

Resources:

If you want to see more e.g. great website themes, these Restaurant Menu Templates might be what you’re looking for. Also take your time to browse these interesting HTC evo cases that will protect and personalize your cell phone.

Author : Dustin Betonio

Dustin Betonio is a Translation Management graduate at University of Mindanao. His earlier career was devoted on customer service outside the information highway. Currently studying Law in the same University.

 

{ 116 comments… read them below or add one }

ACL surgery recoverer July 7, 2011 at 9:02 pm

Hello, thanks for the tutorial.

I have wordpress 3.0, the network plugin installed and configured and everything set to go, but can’t get mapping domains to work.

I tried:
1. Leaving a Godaddy-registered domain parked (with its nameservers pointing at godaddy) and adding an A name record which points to the ip address of my wordpress server, then in wordpress I created a site by that name, then entered in the dashboard of that site and did domain mapping on the wordpress site, saying domain = this blog. And that doesn’t work.

2. Using existing add-on domains on my hosting (they are tacked on to the primary domain via cpanel) and trying to map those. So, these domains have nameservers pointed to the server with wordpress, and within the server hosting wordpress I tried to enter an a name. It doesn’t work either.

Any ideas/advice? I’m not sure if I did either of the above options correctly. I wish I saw an actual step by step example.

Reply

MArco March 22, 2011 at 1:04 am

Hi. I’m trying to configure a network, too.
How can I add the record with iPage vDeck 4? Thanks

Reply

Kris March 17, 2011 at 12:25 pm

Hey Kris, I can’t see Tools->Domain Mapping as well, no metter where I go but followed the second method and it works fine. I don’t know how the second method would work with WP 3.1 though. You don’t see site ID there. You can only assume.

Reply

FBML March 9, 2011 at 11:10 am

Its the best feature in new WP3 and was much needed. thanks for sharing the article on this.

Reply

janos demeter February 9, 2011 at 2:26 pm

Ok,got it work…but I have a issue with mu-plugins…as super-admin I cannot see plugins at all,what might be wrong?

Reply

Adrian Castro February 5, 2011 at 6:23 pm

Hi I just wanted to get you an update on the performance issues I had. I had a Wassup plug-in and when I disabled that performance significantly improved. I also replace the Super Cache plug-in with Quick Cache. My mapped sites now come up in 5 seconds or less.

Reply

Adrian Castro January 7, 2011 at 5:54 am

I was able to follow this tutorial really well – thank you for that!

However, I am having issues with the speed of the mapped domain. It comes up in 20-30 seconds for the first page – afterwards, page loading is fast (not sure if a cache issue – I am using WP Super Cache).

The primary domain comes up in 5 seconds or less.

Time was measured using Mozilla Firefox connected to the internet with a fast cable modem.

This is the primary domain – http://bjjjitsu.com
This is the mapped domain – http://kangendistributor.info

Any advise on why the mapped domain is so slow compared to the primary domain.

Reply

Lars January 7, 2011 at 7:35 am

Adrian, it is quite hard to tell what is woring on the distance. However I can see that pinging and tracing your domains shows really fast response. So from my location it is not network problems making it take 7-10 sec. to load your page. I recommend that you:
1) disable plugins one at the time to see if one plugin is responsible for the masive time consumption
2) consider testing with tools like https://chrome.google.com/extensions/detail/ognampngfcbddbfemdapefohjiobgbdl to see what part of the page load takes time
3) Install http://wordpress.org/extend/plugins/wp-dbmanager/ and make a repair and an optimize on the database
4) see if you can find tips here http://www.tripwiremagazine.com/2009/11/optimize-wordpress-for-professional-performance.html

Reply

steve December 10, 2010 at 2:11 pm

Hi first of all, great article!

I am having trouble with this line in cpanel:

Below “Add New Entries Below This Line”, enter in the first box (Domain) an asterisk: “*”.

It won’t allow me to do so and errors out to: * Name must be a domain with
an optional period at the end.

I cant put the asterix before or after the domain name with or without the period. Has anyone got any clue to what is happening here or a way to bypass this step?

Reply

Jahid Hossain November 7, 2010 at 11:02 pm

Hi. I’m trying to configure a network of 10 sites. When I tried to add an A record in my Hostgator hosting account I found that record is already added. However for 2 sites I again added the record as duplicate and for the other sites I didn’t. But for all the sites i’m facing the same problem. Whenever I hit my original domain name, the browser can’t display the original page instead shows the “index of /” page.
Any expert advice pls…
Thanks in advance

Reply

chris pap October 20, 2010 at 5:26 pm

Hi,
I completed the domain mapping of my second domain and now it looks like this: Whenever i type the new domain into my browser :www.aminoacidsandproteinsblog.com it is opening the site i wanted to open. On the browser address bar though http://www.gettoaustralia.com/aminoacidsandproteinsblog is appearing and not plain http://www.aminoacidsandproteinsblog.com
Is this normal and if yes what about seo. Is there going to be a problem with?
Thanks in advance

Reply

Chris Pap October 14, 2010 at 9:39 am

Hi again,
I have completed the domain mapping on my second domain succesfully but i guess something is not configuered right in the DNS zone of my hostgator-cpanel.
That is because whenever i type http://www.mymappeddomain.com an error page is appearing on my browser.
Any instryctions?
Thanks in advance.

Reply

Chris Pap October 13, 2010 at 11:11 am

Hello,
I am still facing the same problem. I followed each step you suggested but Tools- domain mapping is still not appearing anywhere. What could be possibly wrong?Please help me.
Thanks in advance.

Reply

free classifieds india October 10, 2010 at 4:56 pm

Thanks for the infor and the plugins. Will surely use them.

Reply

tripwire team October 10, 2010 at 10:57 am

Cris I just tested it on my setup and Tools -> Domain Mapping is not found if you are in the main site backend ex. http://<your domain>/wp-admin/. As shown in the guide you need to go to Super Admin->Sites and open backend for the site you want to administrate domains for. Once you are in http://<your domain>/<subsite>/wp-admin/ Tools -> Domain Mapping will appear.

Reply

chris pap October 9, 2010 at 10:29 pm

Oh and something more.
I have private namesrvers for my domain. Should i follow your instructions about DNS editing for both WHM and Cpanel?
Thank you

Reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

{ 5 trackbacks }

Previous post:

Next post:


Web Analytics