The other day, Klint Finley wrote a very good walkthrough of using the new Multisite functionality of WordPress 3.0. In the comments, a lot of people wanted to know how to use your own domain names. Since I’m doing that now, here’s a quick walkthrough/how-to guide.

Step 1: Manual Plugin Installation

The Domain Mapping plugin is not your regular kind of plugin. You cannot install it through the normal Plugins->Add New menu. Well, actually, you can, it just won’t work.

So first, download the plugin manually.

Note: For this tutorial, I will be using the WordPress MU Domain Mapping plugin. However, I am using the trunk version of the plugin. It has fixes in it that you will need for proper 3.0 support. Don’t try it with the regular version. (Note: The regular version works fine. This was originally written before the latest version, or 3.0, was released.)

The plugin has two main files you need to put in the proper places.

Domain mapping php file location

The first file is the domain_mapping.php file. This needs to go into the mu-plugins folder. The mu-plugins folder is a special folder, which you may not even have yet. Just create it underneath the wp-content folder and put that file into it.

Sunrise php file location

The second file is the sunrise.php file. This is a special filename for WordPress. Don’t worry about it, just put it in the wp-content folder.

Step 2: Activate Sunrise

Now you need to edit your wp-config.php file. Add this line of code to it:

define( 'SUNRISE', 'on' );

Simple, really. This will cause WordPress to go load that sunrise.php file and use it.

Step 3: Server info

Now you have to configure the domain mapping plugin so that it knows what it’s doing properly. This is easy to do, really. Go to your main domain’s admin page and log in as a super admin. Then go to the new Super Admin->Domain Mapping menu.

Domain mapping setup screen

Here you have a few different options, but two main ones that count. 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 most people will want to use. If your server uses more than one, you can enter them all here, separated by commas.

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.

Generally I leave only the middle two on. Remote-login is iffy at best, and I want my new domain name to show up everywhere.

Step 4: Mapping the Domain

There’s a bit of a prerequisite here before you do this. When you buy a new domain, you will need to edit its DNS settings to actually point to your server IP or CNAME or whatever you do to make the domain connect to your server. For me, I just give it a new A record with my server IP in it. Easy.

Update: Okay, so there may be more to it than just that, depending on your host. Every host is different, and you’ll have to talk to your host to make them able to point the domain name at your existing site. How to do this varies from host to host, but the important thing is that when you visit your new domain (before you do this!) then you want it to go to your main site, as is.

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, then go to Tools->Domain Mapping.

User Domain Mapping Screen

All you really do is put in a new domain and set it as the primary. Simple.

Note that if you didn’t get the domain pointed at your server before doing this, then your site will instantly vanish from the realm of mortal man. Setting the primary domain takes effect instantly. You won’t be able to access the site through the old domain any more.

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. You can map an id number directly to a domain name here. The Tools approach is a bit easier to use, but this will allow you to map domains without visiting them, as you can access this list from your main domain. You can also correct broken domain mappings from here.

Step 5: Seeing the Mapped Domains

If you go to Super Admin->Sites, you’ll find this type of a listing:

Sites listing

You’ll note that on the right hand side you can see the column showing the mapped domains.

Special Note: See in the picture how I’m using a subdirectory install? That’s relatively new. In older versions of the domain mapping system, you had to use a subdomain installation and wildcard DNS for domain mapping to work. This is no longer the case, domain mapping works just fine with subdirectories.

Conclusion

And that’s how it’s done. It’s not super complex, but it does require some knowledge of DNS and how servers work. If you can successfully set up a multi-site install to begin with, you can probably do this as well. Just be aware that it is slightly finicky, and know that you will break your site if you put in the wrong settings somewhere. However, your main domain will always be accessible as long as you don’t try to map it, so you’ll be able to go in from there to correct your mistakes.

Shortlink:

1,194 Comments

  1. […] Step 3 : Using the Domain Mapping plugin, you’ll be able to change that subfolder URL into the domain URL ( or frankly any URL.. this is why the subdomain/subfolder choice is irrelevant, the domain mapping plugin lets you pick any URL in the world to use, as long as you can make that URL point to the WordPress installation ). Tutorial on how to do this: http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/ […]

  2. I’m getting this note when I have the sunrise.php file defined in my wp-config.php:
    `
    The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.
    `

    How do I remedy that?

  3. Forget it. I read it too quickly and thought it meant to comment out the sunrise.php file.

  4. Stupid questions — does domain_mapping.php go in a subfolder within mu-plugins, or just on its own? I installed it on its own — no subfolder. It sort of worked — I got domain mapping items under Super Admin, but I didn’t get any Domain Mapping item under Tools. Thanks.

    • No subfolder. And the tools menu only appears on sites other than the main one.

      • OK, tried it again. Dropped all the domain mapping tables and reinstalled. I can totally see how this works, but I’m having one primary problem — my primary domain isn’t showing up anywhere and the whole site goes down when domain mapping is activated. When I remove domain mapping, site is back up. Primary domain uses the root of the install, and the whole network is a subdirectory install. IP is set correctly.

        How can I set the primary domain when that’s the root/main site and there is no Domain Mapping option under tools for that site? Sorry to be so dense. Once that primary domain is set correctly, the rest of this looks like a breeze.

  5. Otto:

    As you know, I’m running 3.0 with domain mapping. I’m about to move the entire system from our internal server here at UNC to MediaTemple.

    Do you have any advice on Search and Replace in MySql before I go ahead and make the switch? I’m going to have temp URL’s from media temple and I’m going to have to do a Search and Replace. Given that there are now multiple paths listed in the DB, how tricky has it been for you to migrate everything. Any suggestions?

    Tony Zeoli

    • Hey Otto…any chance you can comment on this?

    • Hey Otto:

      I went ahead and took the huge step of moving WordPress from our production server to a new dev environment. I learned a lot in the process.

      I’m going from domain.com to dev.domain.com. In that process, it’s hard to use a Search and Replace plugin if you’ve exported your DB and imported it into the new database. All the URLs would be broken and you wouldn’t be able to even pull up WordPress. A Search and Replace plugin is useless in that regard. It would only work on a fresh install, where your temporary URL’s would be generated and you could change those URL’s via the plugin, but if like me, you need to move things and leave them exactly the way they are, so all your site ID’s, post content, categories, tags, taxonomies and the like come over.

      First, multi-site triggers as many wp_options tables as it needs for each instance.

      I have three, so that means I had to Search and Replace on:

      wp_options
      wp_2_options
      wp_3_options

      Then, I had to do the same for content and guid in wp_posts

      wp_posts
      wp_2_posts
      wp_3_posts

      Then, I had to change wp_domain_mapping, but just for blog id 2 and blog id 3. Blog id 1 is left untouched because that’s root and it’s changed in its own wp_options table, as well as in other tables, which are:

      wp_site
      wp_sitemeta

      In addition, I had to ensure that my .htaccess file was moved over to allow for Permalinks in multi-site world. And, I had to change wp-config.php to point to the new dev.domain.com and not domain.com. If you don’t change this, you’ll always be pointed to the site that is set in site path.

      Lastly, and this has nothing to do with multi-site, but one might forget, is that your new server needs to have mod_rewrite enabled for Permalinks, so you have to make sure that a load.rewrite file is created in /etc/apache2/mods-enabled and change the rewrite rule for /var/www/ in /etc/apache2/sites-enabled/000-default to AllowOverride All from None.

      While I did do a Search and Replace on all the wp_x_options tables, I realized that you need to ensure that the site path is the correct path for the site itself and not the subdirectory path, i.e. dev.mydomain.com and not mydomain.com/sitename/.

      And, that you should also change your wp_x_options blogname to dev.mydomain.com or mydomain.com, whichever allows you to click on the link name that appears at the top left in your admin that resolves to launching your site.

      Okay…I’m no longer sweating having accomplished that feat!

      I’m going to post this info to my blog with screen shots soon as well.

      Tony

      • Hi Tony,

        I’ve done the same things myself. Using find and replace is the best way I’ve found to move a multisite installation to a new host and domain.

        A couple things of note:

        – You need to fix any email addresses in the db, as they are replaced as well.
        – Using a temporary URL like http://127.0.0.1/~hostusername doesn’t work. I tried this, and for some reason it results in an infinite redirect. When I pointed one of my domains to the server, and did exactly the same find and replace, it worked like a charm.

        I hope this helps someone. That redirect issue had me scratching my head for a week, and not even the most knowledgeable WP devs I spoke to knew about it.

        Cheers,

        Jeff Sebring
        AKA Optic

  6. […] WordPress 3.0: Multisite Domain Mapping Tutorial […]

  7. Hi all,

    have a question:

    i have hosting in hostmonster with 3 domains, 2 of them are add-on, so there is the www root and under that the 2 other domains.

    what i want to do is install the mu in one of the add-on domains, so… should i install the mu in the root of the primary domain, or in the root of the add-on domain i want to use?

    let’s say i have bbb.com, and want to create another blog in bbb.com/aaa . for me to map the bbb.com/aaa to aaa.com do i have to buy the domain aaa.com?

    ty

  8. Otto,

    this was great. The key was to use the dev verison of the plugin. However, I still have a pesky problem, I can’t get to my dashboard for any of the sites created after I made my install Multisite regardless of whether the new site has a domain mapped or not.

    Any ideas? thanks.

    brendan

  9. I never thought domain mapping would be that easy. I will try in my website… Pray for me that I get it done successfully 🙂

  10. in main site it list all my blogs as http://www.mainsite.com/blog1 instead of http://blog1.com even mapping has been done correctly. I check the code in home.php as below:
    ” rel=”bookmark” title=”Permanent Link to “>
    How can I fixing this problem?

  11. i mean
    the_permalink()

  12. Hello – great post.. I have a few quick questions.. Is it possible to set up each mapped domain name so that they can then set up multiple blogs on each domain name? I am trying to figure out how to add one more layer of multi sites to an existing multi site install. What I mean is would it be possible for me to create a CMS system say for realtors – BUT instead of just creating one system where a specific group of realtors create blogs on the site I want to add multiple businesses that then can all have their Realtors then create blogs in one of these mapped domain names from my wp multi site – my idea is to have multiple brands / domains running on one multi site install and then having multiple blogs running on each brand / domain name – is that possible?

  13. ahh,, i completed the install, followed all the steps, everything looks good on the backend, EXCEPT when i go to
    http://designquoter.com/freecreditreportandrepair/

    all i get is “index of /” ?????????????? what does this mean??? theres nothing in the subdirectory, it seems like i have to install wp in the subdirectory?? someone please help, i’ve been stuck on this for hours…

    • Hey David:

      Not sure if you know this or not, but Domain Mapping does not work if WordPress is in a subdirectory of root. You should move all your WordPress files and folder out of its subdirectory, and into root, such that the main site is live at “mydomain.com/index.hp”. Once you’ve set that up, you can set up the second site by creating the new site in the SuperAdmin>Sites. Once you create a new instance of a site, you then map it to its domain by selecting “Backend” and then navigating to Tools in the sidebar, where you’ll be able to map “mydomain.com/thisfolder” to “mydomain.com” after you’ve set up the CNAME record.

      Not sure if that was your fail, but hope this helps.

      • I’m also confused about this.

        are there ever any files in the site path?

        You create a new site from the super admin panel. During this step it asks for a directory (site path), for example: mainsite.com/newsite
        that directory is empty.

        Then I go to my domain provider and modify the newsite.com domain I wish to use for the new site’s @ record to point to the ip of my mainsite.com

        Back on my main site, I click on the “backend” link for the new site i just created, and go down to tools > domain mapping on the new site.

        I add a newsite.com , the one who’s @ record i just set. and select it as primary

        After this it just loads up a 403 error, forbidden on both the admin panel and the actual site.
        if i go back on my browser and switch the primary to mainsite.com/newsite the dashboard panel backend works. but the site wont load either.

        Am i supposed to install instances of wordpress in each site path for each new site created?
        and for existing sites on the same host, hosted under different domains. Can i just set the site path to the existing site and follow similar steps?

        • @Keegan

          WordPress MU is a single installation of WordPress. No, you are not installing three different WordPress directories, just one.

          Remember, you cannot install WordPress in “mysite.com/wordpress/index.php”. It has to be installed in “mysite.com/index.php.”

          Make sure you install all the files in the “root” (main) directory.

          One you install, you can choose whether you want your additional sites as subdomains (dev.mysite.com) or subdirectories (mysite.com/newsite).

          Each site gets it’s own ID number.

          The paths then look like this:

          “/” (blog ID 1)
          “/site1” (blog ID 2)

          …and so on.

          At your domain name manager, site 1’s A record for www should be set to the IP address of your hosting server.

          Then simply set CNAME records for the other domains to point to the same IP address.

          The domain mapping plugin will take care of the rest.

          Make sure you:

          – creatd blogs.dir in wp-content
          – have the file sunrise.php in wp-content
          – have mu-plugins folder with the domain-mapping.php plugin inside wp-content
          – change the code in htaccess that is rendered once you do all this

          You should then be all set.

          • In the CNAME, what is the “host” that points to my main sites IP address? Do I just change my ‘www’ cname points? My www CNAME currently points to @ and the @ in my A record points to my main sites IP addresss. But thats not working.

            This shows it: http://keeganead.com/cname.JPG

            • the quote below in another comment

              “Remember, at your host, you have to create a CNAME record for “domain2.com” and point it to the IP address of “domain1.com”.”

              My dns manager doesn’t allow an IP addresss in the points to field. It wants a “something.domain.tld” or it seems to allow an “@” thats it.

        • By the say, site 1’s path should never be site1.com/newsite. It should be “site1.com/”, that’s it.

          If you’ve installed site 1 in the a directory called “new”, that is wrong.

          The TOP LEVEL directory is either /var/www/… or httpdocs/… on most servers.

  14. thanks for the help, heres where im stuck now,
    i cant seem to get a clear answer to this:
    when all done correctly, is the registered domain(mapped to the subsite) supposed to lead directly to the blog or index.php of the subsite? because currently it leads to the main sites home page designquoter.com which

    primary is subsitedomain.com
    i can only see the home blog page @
    mainsite.com/subsitedirectory/

    how can i make subsitedomain.com lead to blog instead of mainsite homepage?????

    could there be something wrong with the domain mapping plugin? lost and frustrated, would be grateful for some insight.. thanks

    • When you install domain mapping, the primary site (if this is the first time you’re doing this) of domain1.com, should have a site ID of “1”. In the Sites panel, that should be the first site in the list with a path of “/”, since it is not a sub of anything. It is the root site. So when you type in domain1.com, you get domain1.com.

      When you click to add a new site, it adds that site at (and you choose this on setup), either subdir.domain1.com or domain1.com/subdir.

      You ask yourself, well how to I then map “domain2.com?” to domain1.com/subdir (or subdir.domain.com).

      First, if you have two sites, you should have this in your sites list:

      — domain1.com with – Has an ID of 1 at “/”, which means there’s no sub directory, it’s just root.
      — domain1.com/subdir – Has an ID of 2 at “/subdir” which means that it put the second site at the sub directory path.

      Now, you click on the “Backend” link for domain1.com/sudir. Look for the Tools menu and Domain Mapping. It’s in there that you assign “domain2.com” to “domain1.com/subdir”.

      Remember, at your host, you have to create a CNAME record for “domain2.com” and point it to the IP address of “domain1.com”.

      You may not have changed the CNAME record to point the new domain to the IP address.

      Every site you set up should resolve at:

      domain1.com/
      domain1.com/subdir1
      domain1.com/subdir2

      It’s when you set domain mapping under Tools that you get domain2.com pointing to domain1.com/subdir1.

      Does that make sense? Is that what you’re asking? It’s not very clear in the instructions, I know. But, once you get it…you’ll say to yourself…”OH! That’s so easy!”

      Tony Zeoli

  15. [first thanks for the quick reply]
    yes that all makes perfect sense and have followed all those steps, pointed domain2.com to domain1.com server (thats it right? just set domain.com2 nameservers to mine and thats it right? its with godaddy. is there anything else to configure?, when you visit domain2.com it loads domain1.com when parked on domain1.com)

    this is what it looks like, as instructed,

    domain1.com/
    domain1.com/subdir1

    is domain2.com supposed to present the domain1.com page when visited?
    or
    isn’t domain2.com supposed to present domain1.com/sudir1 ???

    after parking do i need to redirect it to the directory? or should it be done automatically?
    and in domain mapping
    http://freecreditreportandrepair.com -primary
    http://designquoter.com/freecreditreportandrepair

    freecreditreportandrepair.com loads designquoter.com, is this correct?? if not how do i get domain2.com(freecred…) to load domain1.com/sudir (desi/freecred…)

    • Yes, domain2.com should point to the IP address of domain1.com.

      Domain2.com is supposed to be mapped to Domain1.com/subdir by clicking on SuperAdmin, then Sites, then “Backend” of domain1.com/subdir and selecting the domain name you added.

      Remember, you’re supposed to add DesignQuoter.com in SuperAdmin, then Domains. You can’t set up Domain Mapping unless you add the domains you want to map to.

      Once you have set up your sites and click on backend, then you should be able to go to Tools of ANY SITE but the ROOT site and click on Domain Mapping there. The tools function doesn’t exist in ROOT, because it doesn’t need Domain Mapping. That’s where people get stumped, because it’s hard to find where you’re supposed to perform the final mapping step.

      It doesn’t exist under your first site. Only under your secondary sites.

      Now, once you get to the Domain Mapping under tools, you’ll map freecreditreportrepair.com/subdir1 to designquoter.com.

      Tony

  16. (i really appreciate your help)
    so if i see “/” then designquoter.com is mapped right? (wp installed in designquoter.com/public_html)
    address bar reads: http://designquoter.com/wp-admin/

    i attempted to add designquoter.com in super admin>domains> after doing that i receive this error:
    “The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.” and the wp-admin no longer functions working to bring back

    other then that all the steps have were completed

    finished last step in backend domain mapping, by making

    http://freecreditreportandrepair.com – the primary
    http://designquoter.com/freecreditreportandrepair

    and all is done, but i dont think its correct, reason being; when i visit freecreditreportandrepair.com the page designquoter.com loads, isn’t designquoter.com/freecreditreportandrepair supposed to load or no?

    • Oh, btw…you can’t run domain mapping with Site 1 as mydomain.com/wordpress, with all the files for the main install of wordpress ONE DIRECTORY REMOVED FROM ROOT.

      When you install WordPress on the server, all the files have to uploaded to public_html NOT public_html/wordpress.

      Remember, WP multisite needs to run in the TOP LEVEL directory. When you download WordPress and unzip the folder, all your files then reside in a folder called “wordpress”. You cannot simply upload this folder itself. You must open the folder and ONLY UPLOAD THE CONTENTS of the folder into public_html, so that the index.php file and all the other files then reside in the main directory — “public_html/index.php”, instead of “public_html/wordpress/index.php”.

      If you’re trying to run domain mapping with Site1 in public_html/wordpress/index.php, then it won’t work. The WordPress files themselves must be placed in public_html.

      Does that make sense?

      Tony

  17. i guess my question is, after its all done, should domain2.com when visited, load domain1.com contents or domain1.com/subdir contents

    and which one should i set to primary in domain mapping?

    sorry this is just really frustrating

    • Right now, I’m running three domains.

      ReeseFelts.org, ReeseNews.org and CarolinaConnection.org

      In Sites, I have:

      (site 1) ReeseFelts.org, taking the first slot and resolving ReeseFelts.org
      (site 2) ReeseNews.org pointing to ReesFelts.org/ReeseNews
      (site 3) CarolinaConnection.org pointing to ReeseFelts.org/CarolinaConnection

      You second and third SITES are either sub.domains or domains/sub.

      • i found a breakdown of how the process is supposed to work:

        – I type in your mapped domain. My internet looks it up in DNS servers aroudn the world. Your registrar tells my computer it lives at (your.IP.address)

        – I get sent to your IP address. Your web server directs me to your WordPress install (the main site).

        – now WordPress looks up the domain in the database and serves the right blog in my browser.

        it is here where my problem lies:
        – now WordPress looks up the domain in the database and serves the right blog in my browser.

        any ideas why this isnt working properly? only thing i can think of is re-installing domain mapping again and again and hope i weed it out somehow..

        • When you visit http://ottopress.com, it goes to the same WP install as http://ottodestruct.com (my main site).

          The SUNRISE bit kicks in and from the URL and the mapping determines that you want to see the content of my http://ottodestruct.com/op blog, which is mapped to http://ottopress.com as the primary domain.

          The “primary domain” is what you want the URL in the browser to be. Any other URLs referring to that same site will get redirected to the primary.

          Any connections that don’t match a mapped domain get redirected to the main site/domain.

        • There should only be one IP address listed under Domain Mapping.

          At your domain manager, create CNAME records for each of your domains that point to this IP address.

          It’s not just your first domain that needs this IP, your additional domains both need this IP address as well.

          I think it’s pointing your CNAME record for www to the main IP address. Domain Mapping handles the rest.

          Tony

  18. ugh!! ok i figured it out, i feel so stupid,, hopefully this helps other beginners, from the very first cry for help everything had been done correctly.(install and configuration wise)
    but i had the original business’s site still uploaded in the root as well, which when i installed wordpress, the designquoter.com business site index.html was loading first instead of the correct blog. i deleted that site index.html and voila it allowed index.php to load correctly for both blogs. ugh.. sorry for the headache, like i said, hope it help another newb,

  19. […] Multisite Domain Mapping: Also, one thing I hadn’t mentioned is that you can also use one installation of WordPress now to manage multiple domains within one WordPress instance. Let’s say you own 10 WordPress powered sites. That’s 10 versions of WordPress and plugins to keep upgraded. You “could” install WordPress 3.0, then enable the “Network” of sites, and create 10 web sites – and then use “domain mapping” to keep all your web sites in just one wordpress install. I would only recommend this to advanced users, but if you’re interested in this scenario – read more here: WordPress 3.0 Multisite Domain Mapping tutorial […]

  20. i downloaded the “trunk version” you recommended… is this the most recent update?

  21. ok, i am trying to map a sub domain to my network site, and i’m not sure whether to use CNAME or the IP in the domain name DNS. If CNAME, what name would i use?? With Google apps, it asks me to put “ghs.google.com” as a CNAME to point my “mail” sub-domain to their servers… Does this make sense?

  22. ‘No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help.’

    Any help would be appreciated

  23. Great instructions and plugin. Thank you! It looks like everything is working fine with the plugin except 1 piece. I have 2 other domains pointing to mainsite.com, but it always loads the ‘Registration disabled’ page when I type them in??? I’ve tried adding in Super Admin -> Domain Mapping as non-primary domains – but it’s not saving them. It lets me save non-primary domains for all site ID’s other than 1.

    Any ideas?

    • Did you click “Backend” then navigate down to the Tools menu and set the correct path under the Domain Mapping settings for Blog ID 2, 3, etc…

      • Tony! Thank you for replying. Yes. Adding domains to sites 2, 3, etc works great! Only for site ID 1 there isn’t the menu option Tools -> Domain Mapping. However, there is Super Admin -> Domain Mapping. But this is where is doesn’t let me save any non-primary domains for site ID 1.

        Do you know if I can manually add domains in the database – or does it not let me save them to protect me from messing it all up???

        Again – thanks for helping.

        • Yes, there is never a menu option for Site 1, because it is the ROOT site in the entire system. The Domain Mapping function under TOOLS is ONLY for all additional sites beyond SITE 1.

          You should be pointing your primary domain from your domain manager to the IP address for your host, and site 1 takes on the responisbility of primary domain.

          If you didn’t want it this way, and you want Site 1 to be some hidden site that simply is the first site in your Sites list, then no domain name needs to be pointed to it. It would just resolve at the IP address in the browser.

          I’m not sure what you’re trying to accomplish here, but Site 1 is always primary, and all additional are sub directories of root that you simply point domains to using CNAME at your domain host.

          • “Yes, there is never a menu option for Site 1, because it is the ROOT site in the entire system. The Domain Mapping function under TOOLS is ONLY for all additional sites beyond SITE 1.”

            Cool. I wasn’t sure if this was b design or not.

            “You should be pointing your primary domain from your domain manager to the IP address for your host, and site 1 takes on the responisbility of primary domain.”

            Yes. Have primary domain working fine. http://johnhall.com

            “If you didn’t want it this way, and you want Site 1 to be some hidden site that simply is the first site in your Sites list, then no domain name needs to be pointed to it. It would just resolve at the IP address in the browser.”

            Site ID 1 is the main site – working fine.

            “I’m not sure what you’re trying to accomplish here, but Site 1 is always primary, and all additional are sub directories of root that you simply point domains to using CNAME at your domain host.”

            We merged 2 sites into one and pointed the no-longer-being-used URL to the one we’re now using. Whenever someone goes to the old url that’s pointed to the new site – it redirects them to the registration page and not the main site. Just trying to figure out how to fix it. Thought by adding non-primary domains to site id 1 it would accomplish it.

            • Instead of pointing the DNS entry to the IP address, why don’t you just use a redirect at your domain manager to always redirect OLDSITEURL.com to NEWSITEURL.com. Doesn’t make sense to try and point it directly at the IP address, because it’s not going to resolve…or at least I don’t think it will, since you don’t have that old domain mapped to any specific instance. Doesn’t make sense to try and point it toward the server, just issue a redirect from the domain manager and you should be fine that way.

  24. Hello! I have the plugin installed and working on a fresh install of WP3.01. sunrise.php in wp-content folder and domain-mapping.php in mu-plugins folder, have domain mapping under SuperAdmin and have added a second site.
    I want site2 to have its own url, siteb.com, resolve to mainsite.com/site2. I host at MT on a dv and have set the dns to the correct IP address. Using Plesk, I created a new site for siteb.com and forwarded it to mainsite.com
    When I browse to siteb.com it doesn’t map to the directory, instead to mainsite.com
    Domain mapping in the backend of site2 has Primary domain set to siteb.com
    Any help would be appreciated.

  25. Yes, on the site2 site backend and then Tools and Domain Mapping, I have at the top showing the Active domains on this blog: siteb.com (the desired url) and the mainsite.com/site2 site. I have siteb.com selected. There aren’t any other settings besides Add new domain.

  26. I looked at that…on the siteb.com I am not using CNAME only an A record. Actually just what MT adds when you add a new site. I have changed the A records to be CNAME records (one with and one without www.) eliminating the 2 A records because they conflict. I will see in 10 or 15 mins what happens. Thanks for your help.

    • I did run through the instructions again and see that it does not call specifically that every domain must be using an A record on the first domain and C record on the others. It shouldn’t really matter, I guess.

      You might want to check the domain in wp-config. Also, did you add the code from the plugin that displays in the admin to your htaccess file?

  27. I did not see anything pertaining to the htaccess file in the instructions. Tell me about that.

    Also, what do you mean about checking the domain in wp-config?

    • You have to update your htaccess file in your root directory with a new set of instructions for handling permalink structure and domain mapping.

      Go to “Network” in your Tools menu and follow the instructions.

      • I checked that and I had done this (forgot!). Still not resolving to mainsite.com/site2 from browsing to siteb.com

        I can’t figure what the problem is…seems like everything is set right. It just doesn’t redirect. When in the backend and I choose from a post, view this page, it errors in the mainsite. I appreciate all your help. Any other ideas?

        • I can’t say that I have any other ideas at the moment. I know I was challenged a little by this at first, then I got the hang of it.

          Maybe check to see if the domain mapping plugin is active, which it probably is, or you wouldn’t be able to see everything.

          In wp-config.php, make sure the domain is “domain.com” and not “www.domain.com”. Maybe that could be it.

          Resetting in Super Admin might be helpful as well, and clearing your browser cache. Can’t say it’s a caching issue but you never know.

  28. Maybe there is a clue here: when I go to domain mapping for site2 and select siteb.com as the primary site, then go to the test post and view page, it is 404 not found on the mainsite.com.

    When I set the domain mapping to mainsite.com/site2 the view test post works, but at mainsite.com/site2/test-post/

    ??

    • SiteA is always PRIMARY. You cannot set SITE B to primary. Everything runs off SiteA being the first site. That might be why you’re having this issue.

      It doesn’t matter what your primary site is, because if they all resolve to their proper domains, then you shouldn’t really care about what’s primary and what’s 2 or 3. You are still going to have a login page for all your sites (or switch between them in Super Admin).

      • Maybe we are not clear.
        mainsite.com is the primary base site.
        The second site is mainsite.com/site2/ and I want diff.com to resolve to this site.

        I have in Domain mapping, Primary site for mainsite.com/site2 set to diff.com and the dns for diff.com has a CNAME record of the IP address.

    • Still pulling my hair out over this. It seems that the rewriting is not happening. Anything that could cause this to not work? Server issues, settings, permissions…I am really looking for the reason.

      When I go to the mapped url, instead it goes to the main sites home page. I can see the test post by going to mainsite.com/directory

      In the Sites tab of Superadmin it shows the mapping of the correct url.

      Need to somehow figure this out.

      • First, check if your host has mod_rewrite in apache config enabled. That could be an issue.
        Second, and unrelated, but something you should be aware of, is make sure you have enough php memory allocated to WP 3.0.1. If not, you can set your php memory by putting an override file ‘php.ini’ in your top level and setting your increasing your php memory_limit=32 or 64 or 96, depending on how much MT allocates. Usually, I set now to 64 MB. You can download a memory manager plugin to show you how much memory is allocated to wordpress. Generally, MT enables mod_rewrite, I think…but check the knowledge base. That’s all I can think of. Try to reset all sites under the Super Admin and see if that helps.

      • also, when you did your “htaccess” file, you put a “.” in front of it, correct? “.htaccess” on the server. You can’t see a system file like .htaccess on your local machine unless you set your system to display hidden files. Not sure if you did that or not.

        • Thanks! All great thoughts, but no hits. mod_rewrite is enabled, loaded the WP overview plugin and it shows # Mem: WP 64M Usage 23% 14.46M Limit 64M *
          I deleted the site2 and added it new. Yes the file is .htaccess

          The live site is owhfarm.com and the second url is owhrep.com
          The subsite is owhfarm.com/rep/

          Most plugins are not activated.

          • Yeah, I see how that’s redirecting. That’s strange. If you’ve got owhrep.com pointing to the IP address, it should resolve Site2.

            Can you look at your “edit” under /rep and see what your domain settings are there? If you’ve got all that completed, then it shouldn’t redirect. Unless somehow, your setting are incorrect.

            I can’t think of why it would redirect. wp-config.php domain should point to owhfarm.com. Site 1 should be that. And site 2, you should be seeing under the Tools, once you add a site, that you should be able to select the domain.

  29. Any way to place files at the root of a domain mapped “sub-site” (for Google Apps/webmaster/etc. verification)? For instance, I have adamp.com mapped to wp42.com. If I wanted to add a file like so:

    adamp.com/some-file.html

    Is there any way to do so? I’ve tweaked the media uploads folder to be bare (no ‘files’ in the url) but that doesn’t seem to work. I can upload the file to the root of wp42.com and that works but then it shows up for all sites.

  30. […] WordPress 3.0: Multisite Domain Mapping Tutorial […]

  31. I’m finding this whole process extremely difficult and very undocumented.

    If you setup a subdomain, the “Domain” is only listed as that subdomain and the “Mapping” shows subdomain.mydomain2.com.

    This to me just feels backwards. Should the “Domain” be mydomain2.com, and the “Mapping” be subdomain.mydomain1.com

    Really throwing me off.

    Also, does anyone have a decent tutorial on setting up CNAMES or ANAMES the right way in regards to getting this multisite option to really work?

    This guy seems to be having all the same problems that I am: http://www.ericshefferman.com/2010/05/21/getting-wordpress-multisite-to-work-part-4/

    Also, am I supposed to be using the development version compared to the latest version? http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/download/

  32. When clicking on “Backend” from within the Super Admin, what causes:

    404 Not Found
    The requested URL /wp-admin/ does not exist.

  33. Hey Tony,

    Yes, I still have not figured out my problems 🙁 Where can I go for help? I am willing to pay someone to get this working if need be. Is there a way to contact Otto? Or ????
    Thanks for your time and great help!

    Robert

    • OK!! I want to report back here the solution I found. 🙂

      Since I host at MediaTemple and use Plesk there are issues about how Plesk handles domain names. Essentially, when you point the dns to a server that hosts multiple domains, it looks for the url record at the server.

      Plesk forwarding does not work because the url is being handled by Plesk forwarding and the target url can’t handle the url. So I do not have an entry for the url I want to forward in Plesk.

      If you use CNAME record and url to forward, then the url is being handled by the dns setting and Plesk still isn’t letting the targeted url handle that url. It just accepts the forward and resolves to the main WP site.

      If you us A record and IP address to forward, then, since there is no record in Plesk, it resolves to the url that is set as primary. Ahha!

      So the only way to make this work with Plesk is to either have a dedicated IP or set you main WP site to the Primary url.

      I hope this makes sense and helps anyone else using Plesk.

      Robert

      • I had said that your main site URL should always be the one using the IP address and A Record.

      • Robert:

        I’m trying my best to follow this, because now I’m having the same issue using a subdomain and it not resolving correctly at MediaTemple.

        I’ve gone ahead and set the subdomain A Record to the IP address setting in WordPress Domain Mapping. But domain mapping is not resolving it correctly.

        Can you someone explain again what you found with Plesk? Did MediaTemple help you?

        Tony

  34. 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 any original domain name, the browser can’t display the original page instead shows the “index of /” page.
    Any expert advice pls…
    Thanks in advance

    • Jahid:

      Your message doesn’t say what you haven’t done, in terms of the install.

      1. Is “sunrise.php” in your wp-content folder? Have you turned on sunrise in your htaccess file?
      2. Is “blogs.dir” in your wp-content folder, and is it writable?
      3. Generally, I find that your A Record should be the domain for Site 1, the primary site.
      4. Generally, I find that your other domains should be using the CNAME to point to the IP address and not the A Record.
      5. Have you read that every site under Site 1 then has its own Domain Mapping panel under the Tools menu, where you then select your domain to point to “site2.com” instead of “site1.com/site2”.
      6. Have you copied over the new rewrite rules generated by multi site into your htaccess file?

      • Hi Tony. Thanks for your reply.
        Well, Step 1 is OK
        I missed the “blogs.dir” and created it just now.
        Step 3 is OK
        Confused about what you said in Step 4
        Step 5 is OK
        Confused about what you said in Step 6
        Can you please explain in more detail.
        Thanks

      • Hey Tony. I’m sorry. You asked whether I turned on sunrise in my htaccess file. No I didn’t. But I turned on sunrise on my wp-config file.

        • Sorry, had no Internet last night in our new house. Couldn’t respond til today.

          You’re right. It’s in your wp-config not htaccess.

          Just want to make sure you enter your new rewrite rules for WP multisite in your htaccess file.

          Also, remember that SITE 1 does NOT have a TOOLS – DOMAIN MAPPING setting. Only additional sites have that panel. You access that through SITES then click BACKEND for the site you want to change the Domain Mapping for. Find Tools then Domain Mapping and set the domain for your subdirectory.

          Tony

          • Hi Tony. Its alright. No prob.
            New rewrite rules for WP multisite are within my htaccess of Site1.
            And yes, I changed the domain mapping settings from Tools > Domain Mapping for all the sites other than Site1.
            I found all the settings to be alright but donnno why it is not working.
            Thanks

            • If you believe you have done all you can on the WP side, then the issue must be with your domain manager and how you are pointing to your WP multisite install.

              Are you sure you are pointing Site 1’s domain to the correct IP Address listed in your multisite install? Are you sure you’ve correctly set up CNAME records on all your other domains to point to the IP address as well?

              • I guess the problem is with DNS Settings. I am very weak in it.
                Let me inform you. All my domains are addon domain on a shared hosting plan of HostGator.
                All the domains have an A record pointing to the server’s IP where my sites are.
                In this scenerio can you please tell me what other DNS records I need. What should be their names and values? I know it sounds stupid but as I already told I am very weak in DNS things.
                Thanks

  35. Hi Admin,

    I have done exactly the same as your tutorial, however, it appeared: “Apache is functioning normally”. Please visit the link below for details:

    http://test.bot.vn

    I want to map test.bot.vn into http://www.studyguide.com.vn/nguyenkhanhlam/

    Please kindly help me. If this issue is because of the host, can you advise me which host is compatible for wordpress mu domain mapping?

    Thank you,

  36. […] to download from the author’s SVN trunk) to support WordPress 3.0. I’ve had better luck following this guide and using the Domain Mapping […]

  37. Hello.
    I hope someone can help me out because I have been searching for quite a while.

    I installed Network and Domain mapping.

    newdomain.com works but all links on the page still points to sub.origdomain.com

    • Lucky:

      You’re message is not very well constructed. It’s hard to know what you are doing wrong or what problem you are having. Did you follow all of the steps in the tutorial?

      Tony

  38. […] Man installiert das Domain-Mapping Plugin in seinem WP-Netzwerk gemäß dieser Anleitung des Autors oder dieser hier. Wichtig ist für unseren Fall die Weiterleitung auf einen CNAME-Eintrag in den […]

  39. Hi guys,

    Quick question.

    Am I setting up a network (to the directory version) BEFORE I activate sunrise.php in config.php?

    If I don’t and I add sunrise.php to config.php, I get an error on logout: “No site defined on this host. If you are the owner of this site, please check Debugging a WordPress Network for help.”

    When I remove sunrise.php from config.php, I get my Admin back with Network choices again.

    Thanks!

    Thanks!

  40. Hi! I’m trying to get the domain mapping function up and running but I have a doubt.

    I have a vps server where many domains poit to the same ip adress.
    so de domain where I’m implementing the domain mapping has the same Ip as the mapped domains , how can I add a CNAME line if the ipAdress is goin to be the same?

    When I go to the
    subdomain.mydomain-where-I-map-others.com
    it redirects to
    domain-i-want-to-have-mapped.com

    But it won’t show me anything.

    Please help!

    • If you are using a vps, with one IP address, then:

      site1.com point A Record to IP address 1
      site2.com point A Record to IP address 1

      If you want to have:

      site1.com
      site2.com
      sub.site1.com
      sub.site2.com

      You must register a second IP address with your host provider.

      For example, I have 3 IP addresses, one for main, one for dev, and one for staging.

      I don’t understand why you have:

      sub.site1.com
      site2.com

      That doesn’t make sense me.

      If your question is, why can’t you create a CNAME record for site2.com with your host, I think with shared hosting you can if you have a domain as the the entry and not an IP address.

      If you only have IP address to work with, then all domains A Records should point to that IP.

      You cannot have a site1.com then try to point an A Record to sub.site1.com.

      At least that is my understanding. Maybe you can but that’s not how I set mine up.

  41. This seems to be a pretty active thread! I’ve been trying to resolve a major issue: The domain mapping is working… I used the parked option in godaddy to enable the dns manager and set the IPs for the a records… setting name servers also works… the problem is when I go to domain 2 I get a 403 error. So I tested this by making a sub directory: domain1.com/test and that also brings up a 403.. has to be something with the hosting… since the domain mapping and dns is all working to map the subdir with the second domain name… and if I place html files in that directory they will show up… without the 403 error.

    My question is: for domain 2: should anything go inside that subdirectory? .htaccess? an index file? or should it just be an empty directory? I can’t find this info anywhere.

    What could possibly be the issue with this? I setup the config file and the htaccess and all of the configurations and sunrise.php and blogs.dir folder all correctly setup and checked a dozen times…

    If anyone can help, I’m sure it may help others! Thanks for listening!

    • It’s sort of active in the sense that the users themselves are trying to help others, but it seems that Otto has moved on from supporting this thread, because he rarely ever posts a response.

      I’m not sure why you would have a “subdirecory”? I mean, you should only have one directory. Your one directory is the only directory that hosts a single install of WordPres, and MU and domain mapping take care of shooting off each instance by using the SITES panel in Super Admin.

      What might be your issue is that you haven’t put your installation in the top level. Not sure if you have your path as site.com/wordpress/wp-admin or just site.com/wp-admin.

      That could be one reason. Most people forget to make sure that it’s in the top level, and not one level down. They keep the files in the “wordpress” folder and upload that folder, instead of just uploading to the top level.

      Did you put your “wordpress” folder in the top level?

  42. Thanks Tony. There’s a few things going on; I don’t have MU installed. Just wp 3.(latest stable) and the domain mapping plugin with the network installed of course. I would assume that domain 1 is at the root level. I’m dealing with 1 and 1 hosting and the structure doesn’t show public_HTML for each domain but rather a directory created for each domain. I would assume that I am therefore qt the root of the domain folder. My client is open to using a VPS if we have to.

    • Hey Matt:

      WP 3.0.1 is MU, so there’s no issue there.

      I have 1and1 as well.

      Here’s the thing, you don’t need to set up every domain at 1and1. If you’re running 1and1 shared hosting, then what you want to do, instead of pointing A Records to an IP address, is to create CNAME records at GoDaddy, which then point to your main domain name at 1and1.

      If you use VPS, then yes, you should be pointing to and IP address. If you use shared hosting, only the MAIN DOMAIN should be hosted at 1and1.

      So, set up DOMAIN1.COM at 1and1.

      Then, point your A Record for that domain to the IP address and set your DNS to 1and1.

      For the additional domains, simply create a CNAME record that points to DOMAIN1.COM, and the Domain Mapping plugin will receive the request from GoDaddy and resolve your domain to the instance of the second site and third site and so on.

      You are thinking that every domain on GoDaddy has to have a corresponding instance at 1and1, and that is incorrect.

      What Domain Mapping does, is basically allows you to install ONE single instance of WordPress. The way you get SITE 2 and SITE 3 and so on, is to use the Super Admin to shoot new “subdomains” off the core.

      For example;

      Site1 is “/”
      Site2 is “/site2”
      Site3 is “/site3”

      etc…

      WordPress and the Domain Mapping plugin do the work of setting up each new instance off the core.

      Remember, Domain Mapping only needs ONE SINGLE INSTALLATION of WordPress, and MU is the function that auto creates new blogs in your database.

      When you crack open your DB in phpMyAdmin, each time you generate a new site, WP gives that new site its own set of tables in the DB.

      You’ll start to see this:

      “wp_options” for site 1″

      Then:

      “wp_2_options” for site 2
      “wp_3_optioins” for site 3

      You’re thinking, incorrectly, that you have to set up every domain at 1and1 and point the A Records to each one. That’s why you’re getting the error, because your CNAME records aren’t pointing to the DOMAIN1, they are A Records pointing to domains at 1and1 that have nothing in their folders, since you only installed WP in the first domains directory, and not (and correctly, I might add) in the second and third domains directories.

      That’s the point of MU…you never have to install more than one version of WP, it’s only in 1 folder attached to the first domain, and then the concept of domain mapping allows you to point domains to the first hosted WP, and the domain mapping plugin “spoofs” this:

      domain1.com
      domain2.com is really domain1.com/site1
      domain3.com is really domain1.com/site2

      WordPress creates the sub directories. You don’t create them.

      Tony

  43. Hey Tony how ya been?! I hope Otto throws some shares on the donations your way.. that is, when he gets done scuba-diving. jk,,
    to all: None of my images will display in media library (or anywhere)on mapped domains. works fine on the main, but just a blank box on all mapped sites. I’ve checked the forums found similar issues but not this exact prob nor a solution for that matter. common suggestions is to dink with the perms in uploads & wpcontent folders 777 or 755, clear cache, change browsers, so far nothing. this has always been the lucky place to solve my unsolvables, any ideas Im ready to try.

    SCREENSHOT

  44. Check your FTP first to make sure that when you upload an image, it’s going into the correct blog.dir upload folder.

    I had an issue with this for NextGen Gallery, and the issue was how I’d mapped the domains, in that I had the A Record pointing to “reesenews.org” and I had my site path as “www.reesenews.org”.

    A simple inclusion of www or stripping that out could be an issue with the path to upload.

    Tony

  45. Tony, I really appreciate your help with this! Very insightful and I understand much better! I’m going to try that out and post the results here.. All of the domains are at godaddy so I will need to transfer domain #1 to 1 and 1.

    Matt

  46. Matt…you don’t need to transfer the domains, my friend. Keep them at GoDaddy. You “POINT” them to 1and1 by accessing your domain manager at GoDaddy, then launching the center panel, which has the MX records (I’m not looking at it at the moment). That is where you add your A Record and CNAME records for that specific domain.

    Yes, you could feasibly transfer the to 1and1, but you’ll have to do the same thing. Domain management and web site hosting are two different concepts. You can have domains managed at GoDaddy, then point them to your servers at 1and1 without having to transfer them.

  47. Tony,

    It’s making more sense…domain records can get a bit confusing… Here’s what I have setup:

    * removed the external domain: domain2 from 1 an 1’s domain manager (says it will remove it but has not changed yet)

    * In godaddy, I removed domain2’s A record and set ‘host’: www / ‘points to’: domain1’s url

    Something must be wrong with this configuration..

    -Matt

    • Hey Matt:

      Not sure why you went ahead and removed domain2.com from 1and1 domain manager. You could have kept it there and just created a CNAME record to point to domain1.com. But, if its easier to manage all domains at GoDaddy, then that’s probably smart.

      In GoDaddy, you should have set a CNAME as [ “www” domain2.com ] to point to [ domain1.com ].

      I’ve come across an infinite loop issue where if you are pointing to domain1.com without the “www”, but your install is using “www” in the file path for SiteURL and other database tables, that could cause an issue with nextgen gallery or other plugins, because domain mapping, I think, strips out “www” in the system.

      It’s a big confusing, yes, I know. But, it is what it is.

Leave a Reply to david Cancel reply

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=""> <s> <strike> <strong>

Need to post PHP code? Wrap it in [php] and [/php] tags.