WordPress 3.0 Multisite With Multiple Domains Setup

WordPress 3.0 multisites lets you easily publish multiple sites, on multiple domains, within one installation.  This is a time-saving option for those of us who need to manage multiple separate domains running WordPress, but it does take a little knowledge and file access to set up, and at the moment isn’t for anyone who doesn’t consider themselves technically proficient.

Editor’s Note: Please note that for many users the excellent WordPress MU Domain Mapping Plugin is going to be a better solution. Our solution is really for expert users only.

You will need to be able to modify your vhosts file in order to do this, but once done you will have a very flexible and powerful server.

This article is written for 3.0 alpha, as of the current build on 19th March 2010.

Multi sites mode

  1. Install WordPress 3.0 and install as a normal WordPress.
  2. Add define(‘WP_ALLOW_MULTISITE’, true); near the top of wp-config.php
  3. Log into the admin go to the tools/Nertwork menu.
  4. If it asks you to deactivate all plug-ins do so otherwise go straight ahead and set up multi sites as sub-domains and fill in the other details as needed as needed.
  5. Make a note of the changes needed to wp-config.php and .htaccess and make the changes.
  6. You should now be in multi-site mode.

Adding a new domain

  1. Now we’re in multisite mode login as admin go to super admin/sites
  2. Add a new site – the address can be anything you like just make it unique and make it something you can remember so we can find it easier in the db.
  3. Make sure your domain is pointing at the server if not do so and wait for it to propagate.
  4. Add Vhost alias to the root domain. So if in the Vhost file you have ServerName mywordpres3root.com you would add ServerAlias mynewwordpress.com beneath it.  Alternatively, you can use a wildcard here, but in our implementations there are good reasons why we prefer to specify the host aliases.
  5. Open up the db for editing and add a new row to wp_site table
    1. site_id, domain and path.
      1. site_id, will be a new unique id, remember it
      2. domain, should be set to the new domain name added above.
      3. path should be /
  6. Change the row in wp_blogs that matches your new site and make a note of the blog_id.
    1. Change site_id to the new site_id created above.
    2. Change domain to our new domain name.
  7. Open up wp_[blog_id]_options table.
    1. Change siteurl to the new domain name.
    2. Change home to match the new domain name.
    3. Change the fileupload_url to match the new domain.
  8. Your new site should now be ready, you’ll need to go in and set all the options for the domain now. If you wanted a clone of the root sites options you could copy all the rows in wp_sitemeta with a site_id matching the site you wanted to clone and just change the site_id to the new site.

The instructions above are given without any guarantee – use at your own risk, especially if converting your site from single site to multisites.  If you have any feedback or better approaches then do let us know in the comments below.

Comments
  • Adénine Network 12 / Apr / 2013 at 1:51 pm

    Good post, very useful for me, thank you.

    One question:
    How select the new domain create for a new site?

  • arpita 26 / Jan / 2013 at 12:34 pm

    Hey great tutorial but I wanted to ask that can I have multiple sites common wordpress files but different database for each website I think in wp-config file I can get the host calling those files and connect to that database accordingly and each website runs with different data but the files or the wordpress code is same for every site Including the template but I do not knoow how to redirect each domain to a common folder containing the wordpress installation and other plugins It is helpful for if I change the design for a site it simply changes the design of other domains also. Please suggest.

  • Dubravko 16 / Oct / 2012 at 2:22 pm

    Hi, James,

    Great article! I’m just in the process of making something like this and I’d like to hear your insight on the idea…

    I am currently writing three blogs for the products of the same company. Now I want to integrate them in the same blog. Articles would be on their own domains to improve SEO and to deliver a bit different design for articles on product #1 etc…
    The only thing that would be the same for all blogs is the header that has a navigation bar that leads to all blogs (divided into categories).

    Is this possible in any way?

    Thank you :)

  • Alex Knight 8 / Oct / 2012 at 11:42 am

    That is great…i guess, i have to make some neccessary changes in .htaccess file. is’nt it ?

  • Sulliwane 15 / Aug / 2012 at 10:48 pm

    Thank you a lot,

    this is the only tutorial explaining proper multi domains with Wordpres MU !!

    I confirm Chris comment, on wordpress 3.4.1 one have to comment out this line in wp-config

    define( ‘DOMAIN_CURRENT_SITE’, ‘www.yourdomainhere.com’ );

    • Sulliwane 15 / Aug / 2012 at 11:46 pm

      Actually I’m wrong, commenting this line has no effect in my case (wp mu 3.4.1) but anyway every newly created website is easily accessed by the drop-down menu of the admin bar. So it works for me without a glitch…

      Thanks again for your article, it made my day !!

  • Matthew Lee 30 / Apr / 2012 at 2:24 am

    Great write up on the wordpress mu multiple domain mapping btw.I just noticed your phone number area code,turns out i was reading this in the building across from you in the ADA! i should of give you guys a wave from my studio,small world.

    • David Coveney
      David Coveney 30 / Apr / 2012 at 10:48 am

      Very small world! You should come along to our SWIG events, you know…

  • Suranga Rajakaruna 19 / Apr / 2012 at 12:59 pm

    I just followed the steps on wp 3.3.1 and sites worked properly. But when i go to “My Sites > Network Admin > Sites” form the backend it does not show the new site added.

    So how do I edit the new site just added ?

  • sanjay 10 / Apr / 2012 at 8:37 am

    Will this configuration prevent duplicate content labelling by serach engines like google and adversely effect my site rankings?

    • David Coveney
      David Coveney 10 / Apr / 2012 at 10:56 am

      Erm – that’s not really relevant to the feature. Duplicate content is duplicate content, so that’ll always be a problem – running multiple domains in this way is a different thing.

  • Chris 20 / Mar / 2012 at 3:20 pm

    Quick update for WordPress 3.3.1 -

    I followed the steps in the original post, but was only able to load the home page of my secondary domain. As soon as I navigated to a sub-page, it would redirect back to the primary (original) domain, and load the wrong site. My permalink structure is as follows: ‘/page-name-here/’, (not the WP default of ‘/?p=xyz’)

    To solve this I had to make a change to the wp-config.php.

    Most people will have the following line in their wp-config.php file:

    define( ‘DOMAIN_CURRENT_SITE’, ‘www.yourdomainhere.com’ );

    For the steps above to work, I found that this line needs to be commented out. If left in, it will override the database check WP does when loading the site and you’ll always be redirected back to the DOMAIN_CURRENT_SITE. I don’t know if this wasn’t part of WordPress 3.0, but it certainly drove me crazy in 3.3.1

    Just thought I’d share in case anybody else if having this problem.

    • Adénine Network 12 / Apr / 2013 at 2:39 pm

      thank you,
      work well,
      I delete this line define(‘DOMAIN_CURRENT_SITE’, ’127.0.0.1′); in wp-config and it’s perfect

  • Ashok Kumar 6 / Mar / 2012 at 5:04 pm

    I have query about multiple website function. I want to change primary website domain with secondary website domain.

    Is it possible or not.

  • Asif Ali Siddiqui 9 / Feb / 2012 at 7:49 pm

    Excellent tutorial, thank you! i have used last year

  • himansu 17 / Jan / 2012 at 5:49 am

    when i change .htaccess file it should be error display of site that internal server error what i do for that..

  • Xananax 28 / Dec / 2011 at 12:05 am

    Done all the changes requested. Everything appears to be working, but permalinks don’t

  • Jonathan Dunn 10 / Nov / 2011 at 3:15 pm

    In network admin I only see the main site under ‘Sites’ and not the 3 others? In addition I am missing plugins from my child sites and the theme that I have added in Network admin is not listed under themes in the child.

    Have I done something blatently wrong?

  • chris 19 / Oct / 2011 at 6:26 am

    I’m not sure if what I want to do is possible.
    we have three separate sites site1.com, site2.com, site3.com.

    blog.site1.com has existed for ages.
    blog.site2.com has existed for a few months and only has 2 posts.
    blog.site3.com doesnt exist yet.

    I setup blog.site1.com in multisite mode, using subdomains.

    In a dev copy I’ve been experimenting, but each new site I create seems to get created as say fred.blog.site1.com and mary.blog.site1.com.

    If I edit the wp-site table, what should the path and domain be?
    should i set domain to blog.fred.com and path to fred, as thats hopefully the end result?

  • Ian Briggs 17 / Oct / 2011 at 7:54 am

    Well, I did it. You inspired my direction. Instead of mapping the domain, or changing the vHost file. I managed to install WordPress3 on the back of a domain, before its public folder. Then, each account created on the server is simply bootstrapped to that common install. All it takes is one index file to locate the install and a few config settings. Viola! Instant no domain mapping, no vHost modification multi domain install! Pheww….

    Cheers.

    • Chase 20 / Oct / 2011 at 7:34 pm

      Mind if I ask how you managed this? Interested in doing something similar.

      Thanks!

    • jibby 24 / Nov / 2011 at 5:50 pm

      Hi Ian, care to share your steps and config settings?

    • sanjay 10 / Apr / 2012 at 8:42 am

      Can you help me, I have a primary website primarydonain.com and I have recently added seconddomain.com and thirddomain.com to my hosting account. WordPress is installed in the root folder public_html folder. How I acces sthis wordpress (or do I need to install wnother wordpress under seconddomain.com?). How I basicalaly access wordpress for my seconddomain.com and thirddomain.com with new themes ?

      • David Coveney
        David Coveney 10 / Apr / 2012 at 10:57 am

        Your server needs to know that all those domains are mapped to the same vhost, WordPress then deals with the rest.

        Also, if you’re having to ask this sort of question then the above probably isn’t what you need – look for domain mapping plugins instead.

  • Ian Briggs 11 / Oct / 2011 at 11:46 am

    I am working with WP to try and separate the core from the content. What your saying is this tutorial would do that?

    I’m basically trying to set the wp-content folder to their corresponding accounts. (ie, their domain). So each domain name carries their own wp-content folder and the WP core is in a common location.

    • Interconnect IT 11 / Oct / 2011 at 11:59 am

      Not quite. wp-content would be the same so plug-ins and themes are shared across all sites but there is a sub folder called blogs.dir/{blog_id}/ that would have the individual sites uploads in it. If you want a different wp-content folder for each site you’d have to do something before the appropriate constant is set.

      • Ian Briggs 11 / Oct / 2011 at 11:59 pm

        Ahh yeah got ya! I see. Thanks for the info. Great post.

  • Thomas Berglund 5 / Oct / 2011 at 3:46 pm

    Excellent tutorial, thank you! What are the pros and cons on using Multisite or Multiple installations. One positive thing is only one installation to update. But when should multisite not be used. I am doing research for a project involving three websites, unique domains, different themes and probably different plugins. Also different editors but the same owner :-) Maybe is multiple separate installations best?

1 2
css.php