Managing and Setting Up a Drupal Multisite
A lot of people run into the scenario with Drupal where they want to have multiple sites, but have them all share the same theme or code base. This is something that's baked into Drupal, but often overlooked or misunderstood. Today we'll be talking about two ways of doing this: Multisite and Domain Access. The decision on which you want to use is based primarily on if you want to share content (domain access) or not (multisite).
This is built into drupal and allows you to serve up different domains or subdomains off of a single code base. If you've used Drupal for a while you'll know that when you install modules and themes they're supposed to go into sites/all, and files and your settings go into sites/default. The reason for this is that these are special folders. The all folder means that any modules, themes, or libraries in it will be shared with all sites installed in the sites folder. The default is what is looked at when a domain comes in that drupal doesn't have a specific multisite setup for. To make additional sites, you just create additional folders under /sites, with the name of your domain and their own settings and file folders.
Additional things you can do are name your folders however you want and then put a sites.php file in your /sites folder that defines what domains go to what folder. If you place modules or themes in a site's folder, it will override any in the all folder and not be shared between sites. Share tables between your sites so they share sessions or any other tables you want by setting up a db prefix on they're settings:
'default' =?> 'name_of_slave_database.',
'users' => 'name_of_master_database.',
'sessions' => 'name_of_master_database.',
'role' => 'name_of_master_database.',
'authmap' => 'name_of_master_database.',
If you want true single sign in, then they need to be subdomains and have a shared cookie domain:
This is a contributed module that lets you run multiple domains off of a single site setup. You can find it and it's companion modules here:
This is a much easier setup, since there are no shared databases or cookies to think about, but also adds more load and configuration to your site. The other issue is that if you want different content on the same path, you have to look into modules to do that, since by default it's literally the same site, just on a different domain and some tricks to redirect or block access to content.