How to: Map your WordPress blog to multiple domains?

How to map your WordPress blog to multiple domains? / WordPress multi domain default site

After looking around several blogs I found many interesting ways in order to achieve this behavior. Generally what happens is that you own your primary domain say but decide you want to purchase the same domain with a or .co but want all of those to point to the same site. To do this the logic is simple, you want wordpress to recognize the domain URL so you enter entries in the database for that and then you want some code on your site to handle the URLs and other cosmetic aspects. This sounds fairly technical but fear not, there is a wordpress plugin that does all this for you! Simply download the WordPress MU Domain Mapping plugin and follow the installation instructions. You can install it from within WordPress but you’ll need to do 2 manuals steps as  detailed below:


  1. Install the plugin in the usual way into the regular WordPress plugins folder. Network activate the plugin.
  2. Move sunrise.php into wp-content/. If there is a sunrise.php there already, you’ll just have to merge them as best you can.
  3. Edit wp-config.php and uncomment or add the SUNRISE definition line. If it does not exist please ensure it’s on the line above the last “require_once” command. define( 'SUNRISE', 'on' );
  4. As a “super admin”, visit Super Admin->Domain Mapping to create the domain mapping database table and set the server IP address or a domain to point CNAME records at.
  5. Make sure the default Apache virtual host points at your WordPress MU site or WordPress 3.0 network so it will handle unknown domains correctly. On some hosts you may be required to get a dedicated IP address. A quick check: in a web broswer, type in the IP address of your install. If you are using CPanel, use the Park a Domain menu to set the mapped domain to your main installtion.
  6. Do not define COOKIE_DOMAIN in your wp-config.php as it conflicts with logins on your mapped domains.


Usually this takes care of the installation and now within each of your subsites you can access under the Tools section the Domain Mapping configuration screen.

How to map your main site to another domain? (i.e. two domains for main site)

So the next thing you’ll notice is that your main site has a unique URL and there is no way to map this to another one. This could be a serious let down but there is a way around this which won’t work for everyone but in some cases the side effects might be a desirable feature of your multisite blog. Currently in a network installation if you try to browse any site including your new top level domain you get a message like:

“Greetings Site Administrator! You are currently allowing “none” registrations. To change or disable registration go to your Options page.”

so the idea here is simple: If instead of showing a message like that you redirect to your main site you get the following:

  • Your new root domain address will redirect to your main site, in essence achieving what you were looking for
  • All subdomains/sites you haven’t created are redirected to your main site instead, as most likely it was a typo.

Now, for those who have open registration and use this method to register other sites this might not be the solution they are looking for unfortunately. But if this is just what you needed here is all you need to do:

To hide that message you must edit your wp-config.php file and add the following definition:

define( ‘NOBLOGREDIRECT’, ‘’ );

Obviously, you have to change the URL provided there to your main site’s URL. Hope this helps!

Enhanced by Zemanta

You may also like...

Leave a Reply

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

%d bloggers like this: