Sharing content, users, and configurations across multiple Drupal sites

XAMPP has proven useful in creating multiple, uniquely named, sites on a local sandbox server. The primary motivation for this was to play with Drupal's Domain Access module. This module allows a single instance of Drupal to share content, users, and other configurations across multiple Drupal sites.

To start with, I edited C:\xampplite\apache\conf\extra\httpd-vhosts.conf and C:\WINDOWS\system32\drivers\etc\hosts to create the following domain names:

Only http://ignitesport.six is mapped to a Drupal installed, the other domains will be set up using the Domain Access module installed on http://ignitesport.six.


(Don't worry about the settings_*.inc files for now, we'll cover those later.)

1. Install the Domain Access module
Install Domain Access 6.x-1.2 by unzipping it into your modules folder. This provides a number of modules, all of which are dependent on the main Domain Access module. Installing this allows you to add domains:

The documentation can be found in a number of README.txt files. These will instruct you on how to edit your settings.php to use Domain Access. After installing Domain Access, I copied modules/domain/settings_custom_url.inc to sites/default, and appended the following to the end of sites/default/settings.php:

require_once 'settings_custom_url.inc';

2. Add the domains to be managed by Domain Access

Browse to the newly added domains (e.g. http://ignitegolf.six) which should be a fresh Drupal install.

3. Install Domain Access' Domain Prefix and Domain Themes modules
Installing these additional modules provides the functionality to share users, content, and themes across multiple sites. After enabling Domain Prefix and Domain Themes on http://ignitesport.six/admin/build/modules, I copied modules/domain/domain_prefix/settings_domain_prefix.inc into sites/default, and appended another line to the end of settings.php:

require_once 'settings_domain_prefix.inc';

4. This provides a few more configuration options on the Domain Access admin pages

Navigate to admin --> domain access --> table prefixing and leave everything to Igore, except for Node and Users, which should be set to Copy. This allows for users and content to be shared across the domains.

Update the users (admin --> user management --> users) and edit the users you would like to provide Domain access settings to.

Also, create or update nodes that you would like to share across domains:

Themes' settings can be applied from within Domain Access (admin --> domain access --> batch updating --> theme settings):

Browsing to the 'affiliate' domains now demonstrates individual Drupal sites, with their own themes, shared users, and shared content:

Comments

Very helpful site!!
However, I'm hitting a brick wall when I'm creating a story or a page. When I publish to a specified affiliate, it ended up publishing to all affiliates. I even made sure "Send to all affiliates" is unchecked. Have you seen this issue?

Thanks!

Guest (not verified) | Thu, 07/16/2009 - 09:19 |

I'm assuming you're referring to "2. Add the domains to be managed by Domain Access". From memory, I was able to successfully use subdomains for that configuration. If you're receiving an error message, submit an issue for the module developer with the details.

em | Tue, 01/13/2009 - 16:28 |

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <img /> <br /> <br> <p> <blockquote> <sub> <sup> <hr /> <hr>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

Captcha
This question is used to make sure you are a human visitor and to prevent spam submissions.
Copy the characters (respecting upper/lower case) from the image.