Note: This article was originally published in 2012. Some steps, commands, or software versions may have changed. Check the current WordPress documentation for the latest information.

In this step-by-step guide, you’ll learn map your wordpress blog to multiple domains?. WordPress is the world’s most popular content management system (CMS), powering over 40% of all websites on the internet.

Prerequisites

Before you begin, make sure you have:

  • WordPress installation (self-hosted)
  • Administrator access to WordPress dashboard
  • FTP/SFTP or file manager access to server files

How to map your (http://wordpress.org “WordPress”) 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 http://technology.bauzas.com but decide you want to purchase the same domain with a .com.mx 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 (http://wordpress.org/extend/plugins/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 (http://wordpress.org/extend/plugins/ “WordPress Plugin Directory”) 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 (http://en.wikipedia.org/wiki/CNAME_record “CNAME record”) 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 (http://en.wikipedia.org/wiki/IP_address “IP address”). A quick check: in a web broswer, type in the IP address of your install. If you are using (http://www.cpanel.net “cPanel Inc”), 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 (http://en.wikipedia.org/wiki/Top-level_domain “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’, ‘http://www.bauzas.com/’ );

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

(http://img.zemanta.com/zemified_h.png?x-id=b7a80247-562e-4bc6-a46c-b01dd735753c)](http://www.zemanta.com/?px “Enhanced by Zemanta”)

Summary

You’ve successfully learned map your wordpress blog to multiple domains?. If you run into any issues, double-check the prerequisites and ensure your WordPress environment is properly configured.