Updated about 6 years ago by Jon Goldberg

CiviCRM multi-site checklist

The first two steps have more detailed docs below.
  • Follow the multi-site docs here.
  • Set up cron and Scheduled Jobs per site for sending mail and incoming activity handling (see here).
  • Install the "multisite" extension. There's an install bug on the one on the directory, use github
  • Multisite extension adds new permissions which need setting. If using Domain Access, you can set the permissions once. If using Wordpress or Drupal "true" multi-site, user permissions are per-site!
    • CiviCRM Multisite: view all contacts in domain
    • CiviCRM Multisite: edit all contacts in domain
    • CiviCRM Multisite: list all groups in domain
  • Make sure you set all the settings that are per-site! Especially:
    • Postal/e-mail address for the default organization
    • "From" Addresses
    • CiviMail > Mail Accounts > Bounce Account (should match main site)
    • CiviMail > Mail Accounts > Email-to-Activity account (unique per site)
    • System Settings > Outbound Email (usually should match main site)
    • If Wordpress: base page (note that this allows you to set a different theme per site)

Editing civicrm.settings.php

Protip: Did you remember to comment out CIVICRM_DOMAIN_ID and CIVICRM_UF_BASEURL?

If you're using a "true" multi-site, where each site has its own civicrm.settings.php, the documentation on the CiviCRM wiki will suffice. Even if you're using Wordpress or Domain Access, there's good documentation there (I know, I wrote most of it).

The trick is to write code that can determine your domain based on the URL. Here is an example of how to do that using Domain Access or Wordpress with subdomain multi-site:

switch ($_SERVER['SERVER_NAME']) {

case '':
case '':
  define( 'CIVICRM_DOMAIN_ID', 1 );
  define( 'CIVICRM_DOMAIN_GROUP_ID', 2);
  define( 'CIVICRM_DOMAIN_ORG_ID', 105383);
  define( 'CIVICRM_UF_BASEURL'      , '' );
  $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = '';

case '' :
  define( 'CIVICRM_DOMAIN_ID', 2 );
  define( 'CIVICRM_DOMAIN_GROUP_ID', 19);
  define( 'CIVICRM_DOMAIN_ORG_ID', 106726);
  define( 'CIVICRM_UF_BASEURL'      , '' );
  $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = '';
// etc.

Wordpress with subfolder multi-site is a little trickier, here's what I've got. Note that this allows you to set a POST variable when running cron (via wget) to specify the correct site:

$multi_site_path = explode("/", $_SERVER[REQUEST_URI]);
if ($multi_site_path[6] == "cron.php") {
    $multi_site_choice = $_POST["site"];
} else {
    $multi_site_choice = $multi_site_path[1];

switch ($multi_site_choice) {

case 'wp-admin':
case '':
case false:
  define( 'CIVICRM_DOMAIN_ID', 1 );
  define( 'CIVICRM_DOMAIN_GROUP_ID', 84);
  define( 'CIVICRM_DOMAIN_ORG_ID', 1);
  define( 'CIVICRM_UF_BASEURL'      , '' );

case 'hcnmd':
  define( 'CIVICRM_DOMAIN_ID', 2 );
  define( 'CIVICRM_DOMAIN_GROUP_ID', 74);
  define( 'CIVICRM_DOMAIN_ORG_ID', 67459);
  define( 'CIVICRM_UF_BASEURL'      , '' );
// etc.

Cron with multiple sites

You need to run cron separately for each site to run its scheduled jobs. Here's a good example of how to set it up.

0,15,30,45 * * * * /usr/bin/wget --config=/home/members/xxx/sites/
1,16,31,46 * * * * /usr/bin/wget --config=/home/members/xxx/sites/
2,17,32,47 * * * * /usr/bin/wget --config=/home/members/xxx/sites/
3,18,33,48 * * * * /usr/bin/wget --config=/home/members/xxx/sites/
4,19,34,49 * * * * /usr/bin/wget --config=/home/members/xxx/sites/
5,20,35,50 * * * * /usr/bin/wget --config=/home/members/xxx/sites/

Note that each civicrm-wgetrc file has the "site" set differently in the post-data. E.g.:

output_document = -

Updated by Jon Goldberg about 6 years ago · 5 revisions

Also available in: PDF HTML TXT

Go to top