Please note that as of August 11, 2008, Donncha has released a domain mapping plugin that makes this process easier at the cost of creating subdomains off the newly mapped domains. On the other hand, the XML-RPC continues to work.
WordPress has been absolutely amazing. It has grown from merely being a blogging platform to more of a CMS/blog platform now. With WordPress Mu (Multi-User), it takes WordPress to a whole new level by allowing for multiple instances of WordPress on one install with one database! The best example of WordPress Mu in use is WordPress.com.
A new feature that was introduced on WordPress.com is domain mapping. Currently when a user visits a WordPress Mu installed site (depending on if the install is subdomain or subdirectory), and signs up for a new blog, the url is http://subdomain.domain.tld/. What domain mapping allows is for a user with a registered domain name to park it on their site at http://subdomain.domain.tld/.
What is the advantage of being able to do this? Well for me, it’s quite advantageous. Since I run multiple WordPress sites, instead of having to download WordPress, upload it, configure it, etc., I can create a new subdomain blog on my main site and then use domain mapping to make the subdomain appear as it’s own domain site. This allows me to share the user tables, themes, plugins, etc. thereby saving space, have only one database to backup and so on.
Unfortunately there is no easy and quick way to do domain mapping with WordPress Mu (yet). There are a few threads on WordPress Mu’s support forum on how to do it, but I figured I’ll make a clear and precise directions on how to achieve domain mapping. Much of the directions I use are from drmike’s thread at the WordPress Mu support forums.
Before you can use domain mapping on WordPress Mu, there are certain criteria that your WordPress install must meet.
- It must be a WordPress Mu install and not a WordPress install and it has to be working correctly.
- The WordPress Mu install must utilize SUBDOMAIN and not subdirectory feature.
- You must already have a domain name registered that you wish to use.
Please note that while it is not impossible to do domain mapping on hosted websites, it will be much more easy and worthwhile to have at least a virtual private server (VPS) or dedicated server, or you will have to contact your host each time you wish to add another domain to your WordPress Mu install. The instructions I present are based on a person with a VPS.
I provide these directions for my own reference and for other people who are interested. Use all or any part of this guide at YOUR OWN RISK. I take no responsibility for what may happen by following this guide. Always remember to make backups of your database before making any drastic changes FIRST!!!
- Login into your domain name registrar, and edit the nameservers to match your WordPress Mu domain nameservers. Most registrars will let you do this yourself, but in some rare cases, you may have to contact them. This process can take anywhere from 10 minutes (if it is a newly created domain name) to 24-48 hours to resolve correctly.
- Login into you main site’s cpanel and select PARKED DOMAINS.
- Under “New Domain Name:”, enter the registered domain name that you want to do domain mapping with minus “www” prefix. In my case, I want to domain map http://www.abunchofcars.com, so I enter abunchofcars.com into the field. Click “Add Domain!”
- You should get something to this effect:
Parked Domain Additions Using nameservers with the following IPs: 184.108.40.206,220.127.116.11 Bind reconfiguring on vps using rndc Created DNS entry for abunchofcars.com abunchofcars.com was successfully parked on top of bui4ever.com
If you get an error, it usually means that the nameservers have not resolved fully yet and you will have to wait a bit longer before continuing to this step.
- Once the domain name has been parked, login into your web host manager (WHM), usually located at http://domain.tld/whm/.
- Scroll down the left hand list until you find the category, “DNS Functions”. Click on “Edit DNS Zone” and select the parked domain name and click “Edit”.
- Inside you’ll find a bunch of things. What we are looking for is under Domain your parked domain name, TTL of 14400, Record Type of A and next to it an IP address. We want to copy that entire IP address.
- Scroll all the way down to where you see “Add New Entries Below this Line”, we need to create a new entry.
- This is what you should type in there: *, 14400, A, 18.104.22.168, obviously changing my information to your information.
- Click “Go” and you should get a “Zone Modified!” message.
- You will need to restart apache for this to take effect. If you have a VPS or dedicated server:
in a command line should do the trick.
- Now login as Admin to your WordPress Mu site.
- Under “Site Admin” > “Blogs” > “Add Blog”, create a new blog naming it anything you want for now. Test to make it sure it works.
- Once the new blog has been created, go back to “Site Admin” > “Blogs”, find the newly created blog and select “Edit”.
- There are four places we need to make changes at. Under URL, you will see http://abunchofcars.bui4ever.com/, change that to http://abunchofcars.com/. Look for Siteurl, Home, and Fileupload Url and make the same changes as you did with Url, but leaving the suffix of “files” at the end of the Fileupload Url. Please note that it is very important that if the address has a trailing slash, you also include the trailing slash.
- Click “Update Options”, once it’s done, you’ll be returned to “Blogs” and notice that the newly created blog no longer is in the list.
- Before we can access the newly created blog, we need to make some changes in the MySQL database. Login to your CPANEL and PHPMYADMIN (I highly recommend you get the PHPMyAdmin plugin so you don’t have to always login to CPANEL to access PHPMYADMIN).
- Select the correct database from the drop down under “Database”.
- On the left hand side, scroll down until you see “wp_blogs”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.
- Scroll down and you will see a list of all the blogs that have been registered. At the very end of the list, you should see abunchofcars.com under “Domain”. Click the pencil icon to edit that entry.
- Once it finishes loading, we want to change “site_id”‘s value to be the same as “blog_id”. For me, abunchofcars.com’s blog_id is 25, so I change site_id 1 to 25, and click “Go”. What this does is remove bui4ever.com (site_id 1) as the “blog owner” and make abunchofcars.com its own blog owner. Also you should remember the blog_id, as you will need it for the next few steps.
- On the left hand side, scroll down until you see “wp_site”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.
- You should see one entry for your main blog. What we need to do is add an entry for abunchofcars.com. Click on “Insert” and we need to populate three values.
- For “id”, we enter the blog_id, in my case, 25. For “domain”, we enter the domain address, so I enter abunchofcars.com. And finally for path, we just put a forward slash (/). Click “Go”.
- So when you go back to wp_site and click “Browser”, you see your new entry.
- On the left hand side, scroll down until you see “wp_sitemeta”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.
- We need to duplicate the contents of “meta_id” 6, the site_admins. Click on the pencil to edit it.
- In the “meta_value” field, you will see a big box with an entry:
Copy in its entirety.
- Click back on wp_sitemeta, and select “Browse”. Go to the very last entry, and make note of the “meta_id” number. Now click “Insert”.
- We need to make entries now, under “meta_id”, enter the next consecutive from the number you made note of in Step 27. In my case, the last entry was 64, so I will be using 65. The “site_id” you use is from Step 19, so I will enter 25. The “meta_key” is site_admins. In the big field under “meta_value”, paste the weird string we copied in Step 26. Click “Go”.
- We need to duplicate another entry, click wp_sitemeta and “Insert”. For “meta_id”, we need to use the next consecutive number. Under “site_id”, we use the same number from Step 19. For “meta_key”, enter site_name. In “meta_value”, enter in your parked domain address. In my case, I would enter abunchofcars.com. Click “Go”.
- The final entry that needs to be duplicated is “illegal_names”. So go back to wp_sitemeta, and click “Insert”. For “meta_id”, it needs to be the next consecutive number from what was used in Step 29. For “site_id”, enter the site_id from Step 19. The “meta_key” is illegal_names and the “meta_value” entry is
- Now we should be good to go for testing. Open a web browser and enter in your parked domain address, I enter http://abunchofcars.com and you should see a newly created WordPress blog. If you don’t, a mistake was made somewhere.
- The next step is test login. Try your admin login and you should get in fine. Please note, if you type http://abunchofcars.com/wp-admin it will redirect you to your main site’s site admin. It is very important that you include a trailing slash after wp-admin, so http://abunchofcars.com/wp-admin/. Hopefully this issue will be resolved in the near future.
- Now another cool feature of the domain mapping, is that you can also create subdomain blogs off of the newly mapped domain. I can create http://how-to.abunchofcars.com and users can also sign up for their own blogs as they do on the main site. Cool huh?