I want to host multiple sites with one database using Organic Groups. For example, if I had an organic group named "students" all the content would live in /students/. I'd like to use a subdomain for this, but not sure how to configure it. I added ServerAlias students.mysite.com to the main site's apache config file, as well as a symbolic link for the subsite in sites/students.mysite.com that points to sites/www.mysite.com so it will use the same database, but I think I need to use some type of mod_rewrite so that when someone goes to http://students.mysite.com/, they get content from http://www.mysite.com/students/, but the URL still looks like http://students.mysite.com/. Any way to do this?

http://www.mysite.com/ <- all other traffic
http://students.mysite.com/ <- gets content from www.mysite.com/students/ and keeps the URL looking like http://students.mysite.com/

Comments

grndlvl’s picture

ArunK’s picture

How is this setup compared to a standard multisite setup like site1.mydomain.com, site2.mydomain.com, etc? I was looking for a setup where the most popular content from across the network: site1, site2, etc would be displayed on mydomain.com.

grndlvl’s picture

You can share tables, so that data can be shared across the domains.

johnnyd’s picture

What I'm trying to do is have multiple sites all using the same database and no table prefixing. The table prefixing is not such a big deal, although if I did, there'd be a whole lot of tables. OG does a good job of segregating my content, so I just wanted to use subdomains for each OG. The nice thing about this config, if I can get it to work, is that when a patch to Drupal or a module comes out, I just have to visit the main site's update.php file instead of having to visit every site and run the update.php file. I think that's my biggest hangup at this point, if I have to create a new site (/sites/newsite.com) for every site, then maintenance becomes a nightmare. If OG can segregate the content and I can map a subdomain to each OG's path, then I only have to update one site. I think the issue is getting Apache to NOT redirect to the new path, as that will cause Drupal to try to find a matching subdomain folder in /sites (e.g. students.mysite.com). What I need is for it to just rewrite the URL the user sees to something like http://www.mysite.com/students/, but still get the content from http://www.mysite.com/students. Sound doable without the domain module mentioned above? Although the domain module may do the job, I think it's overkill for what I need, or not, don't know.

setvik’s picture

Hi,

i just released a new module that we've been using on our site for over a year.
It's called subdomain and accomplishes what I think you're looking for.

It places each OG group and that group's content on its own subdomain.

check it out at: http://drupal.org/project/subdomain

If you need more flexibility and access controls than subdomain provides, the domain module would be the way to go.