I wanted a way to have multiple drupal sites on different subdomains (or domains) with different front pages that could share content and which ideally had a single administrative section. I did a lot of reading over the past day looking for a solution.
What I found was a lot of people looking to do something similar, but the solutions, where they existed, didn't really serve my needs.
For those that are interested, this is what I hit upon.
Drupal lets you host multiple sites off a single copy of the code by setting up separate settings files for each installation (2nd half of step #4). Drupal lets you configure the default homepage for each site. Usually this is stored in the database, but it can be overridden in the settings file. The solution is to put the two togeather. Make a copy of the main settings file for each site and override the home page to point to a taxonomy view filtered by the category used to flag the content. Now try it out. It seems to work.
So, step by step:
- Install Drupal
- Create a vocabulary that designates where content should appear and enable it for all the content types you want to share between sites (look under "adminster:categories"). If you want content to appear on multiple sites, be sure to check the "multiple select" box.
- Add terms to the vocabulary for each target site.
- Set up DNS aliases for each additional site that points to the main site (I suggest a CNAME record).
- If necessary, configure apache to fulfill requests for the subdomains from the same document root as the main site. If you are using CPanel or another hosting control panel, you might have to "park" the additional domains.
- create copies of the main site's settings.php (sites/default/settings.php) and place them in "example.com" and the additional site was "zinc.example.com" then you'd need to put a copy of the settings file in "sites/zinc.example.com/". See the Drupal install instructions for detailed information on naming the directories properly.
- edit the settings.php file for each additional domain:
- Update
$base_urlto match the name of the additional domain ($base_url='http://zinc.example.com';for example). - Override the front page:
$conf = array ( 'site_frontpage' => 'section/zinc',);
- Update
- Save the file and try visiting the additional site.
Note: I have installed the pathauto module which provides nice human readable URLs for pages, including taxonomy views. As a result, I can use "section/zinc" to designate the front page, rather than "taxonomy/x/y". You could also do this by hand configuring things in the path module.
This approach isn't perfect, but at least this gets me up and running and gives me something to build upon. I hope other people will find it useful as well.
A bit more background is available in my blog entry on the subject.
Comments
eas, this would be great in the handbook
Would you consider creating a page in the handbook with this info? Thanks.
- Robert Douglass
-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net
Very useful post!
Thanks,
I am having similar issue - I would like to have a DRUPAL site, but the administration area (under .../admin/*) to be protected with SSL - as far as I understand this could be another site connected to the same database?
So, I've posted a question in this forum (http://drupal.org/node/28601) and I think based on your post and the answers to my original question I will be able to model the requirements!
Diman Karagiozov
Tetracom IS Ltd.
http://www.tetracom.com