Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By codemann on
I'm reading a lot about Drupal, and so I've read about the multi-site installation option.
They explain there that you should put everything in the sites folder and use correct folder names, for example http://www.example.com:8080/ could be loaded from sites/8080.www.example.com/.
But I don't understand how to configure this in Apache or IIS.
Can I just assign every hostname to the root folder and will Drupal take care of everything?
Comments
VirtualHosts
I can only speak for Apache as that is what I use.
You should look into the VirtualHost directive - see http://httpd.apache.org
The you specify both port and DocumentRoot. Once that is correctly setup Drupal will take care of the rest.
I know how to configure an
I know how to configure an Apache or IIS, but should I direct all the hostnames for my drupal sites to the same root directory?
Does Drupal handle all the rest?
Yes
I am doing this with my webhost and I point all of my domains to the same folder and drupal out of the box figures out what to do with the sites folder.
Joe Moraca
http://www.moraca.org
OK :)
Yes. You are using the same core files after all. All the magic happens through the configuration and the fact you are using seperate databases.
So mysite.example.com and yoursite.example.com both point to /webserver/root/sites/.
You place your modules inside the Drupal /sites/all/modules directory to make them available both on yoursite.example.com and mysite.example.com.
Configuration of the sites (and modules) happens individually as they both run from a different db.
Thanks !
Thanks guys for the quick responses !
Step-by-step
In my book link below, there is a step-by-step set up for multiple sites.
Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes
NancyDru
Do you have access to a
Do you have access to a control panel? If so, you can save yourself the bother of editing httpd.conf/configuring Apache etc by simply parking the secondary domains on the main domain holding the drupal codebase.
Easy multisite using cPanel:
By parking the domain for your second site (if it is a top level domain, it should have been registered, if it is a subdomain, then it's fine) on the main domain, you are creating a server alias that points to the same document root- the drupal codebase. This steps automatically configures httpd.conf for you.
-Create a db for the second site
-Create a db user for the second site
-Grant this db user all privileges to the db you just created
Notes:
If you use cPanel to create drupal multi-site, DO NOT create the secondary sites as separate accounts in WHM (Web Host Manager). You just need to create one account for the main domain.
- You are running drupal 5.0 and above;
- You have access to cPanel for your domain;
- Adding parked domains is configured in your cpanel
- You can create multiple databases
- You are running the additional sites from their web root and not from subdirectories
----
Previously user Ramdak.
Slight variation on the problem
This sounds very close to the problem I am having. I am a new user to drupal. Just installed Drupal 5.1 (via Fantastico on BlueHost). I installed it on both the main domain and and an add-on domain. The main domain is fine. The add-on domain is fine if accessed via http://www.maindomain.org/add-on/. However, if I access it via http://www.add-on.org/, I get all the correct content but absolutely no theme material (no colors, no images, etc). The theme is Garland and appears just fine if accessed via the www.maindomain.org/add-on.
Given that all the content is showing up in both cases, I am assuming that the database situation is fine. Given that the theme will show up if accessed via the maindomain, I am assuming the theme structure is fine. Which makes me think that I should be doing something with the settings.php file in the default folder inside the sites folder of the add-on folder. But when I tried explicitly setting the default theme in that file, I broke it. I guess I should add that I did a second Fantastico install of Drupal for the add-on site. I installed it into a folder named the same as the add-on domain. Perhaps that was my mistake.
I checked the troubleshooting guides but didn't see anything applicable. However, it is now 3:41 AM so I might have missed it.
Thoughts? (And advanced thank you for any help).
No Reply Yet?
That's really funny... no reply for so long... what is the answer, by the way?
Bluehost &/or Hostmonster
I believe this is because you installed Drupal directly in the root which will affect all domains. By root i mean your public_html.
when you add-on other domains their root would be public_html/add-on or public_html/add-on.tld since they updated to cpanel 11. With this schema the .htaccess in the root is controled by Drupal and Drupal is seeing the add-on as part of the origional. so, even though you have an install in the directy for your add-on when you address without the www. you are not actually going to it you are going to the drupal install at the root-domain. How you are connected to the right database is beyond me.
Now why it works when you use the www. This is because of the setting in http.conf or in .htaccess. Because the first domain knows it is at http://yoursite.com and not at the alias of www.yoursite.com it treats all request without the www. as belonging to it. So, when you go to www.your-second-site.com the Drupal code installed on the root is bypassed and now you are running from the actuall Fantastico install for your-second-site.com. Hope that makes sense.
The fix depends on whether you wan't drupal and non drupal sites hosted on that account.
to have both with the primary domain running Drupal you need to do what I did on my Hostmonster account I installed Drupal in a sub_folder. (not a sub-domain, although you could use a sub.domain) so my path was "/home/username/public_html/Drupal" and I have a .htaccess
"
Options +FollowSymlinks
RewriteEngine on
#This would be for your primary domain.
RewriteCond %{HTTP_HOST} ^mydomain.com?$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com?$
RewriteRule ^(.*)$ http://mydomain.com/Drupal/ [R=301,L]
"
Setup this way I am able to have add-on and sub-domains resolve correctly.
BTW- If you are going to use Drupal for multiple domains why keep installing? just use cpanel and setup new domains as parked instead of add-on and follow the multi-site install proceedure. I know that setting up each new domain is a little more work because you have to create directories. and copy the config.php then edit it with settings for your database. But it is not hard.
Thank you very much
I have been struggling with this for a month now. Very good stuff!!!
http://jamesdeer.net
http://textslayer.com
Please correct if I am wrong...
Hi folks,
I am new to Drupal and I want to ask you whether I am correct what you said about these intranet multisites.
/root/
/root/site1/
/root/site1/subsite1/
/root/site1/subsite2/
/root/site1/subsite3/
/root/site1/subsite4/
/root/site2/
/root/site2/subsite1/
/root/site2/subsite2/
/root/site2/subsite3/
/root/etcetcetc
How can I make it possible? Configure httpd and create new db names for these intranet sites?
Thanks!
DJH
path to root site
I believe the reference to root site is the path to the root site. Root site being the first domain you set Drupal up in. for example on my hosted domain at BlueHost the root was;
/home/user/public_html/
you need to point your sub.domain back to the root. NOT Linux Root but the root for the first site. And for Sub.domains according the the Multisite install instructions you will need to use symbolic link to point the sub. to the site root.
As far as the directory setup inside of Drupal (meaning the location of the drupal files) you should already have sites/
so, for each new site or sub.site you would have the following dir path assuming your Drupal is NOT already in a sub folder.
~/public_html/sites/default |this is where the config.php file is. now create a new directory under sites/ with the name for your new domain or sub.domain. Some examples...
~/public_html/sites/sub.domain.com
~/public_html/sites/newdomain.com
~/public_html/sites/sub.newdomain.com
~/public_html/sites/another-domain.com:8080
This is not conclusive. You will still need to follow Multi-site instructions concerning database setup and editing config.php.
whats with the 8080
you have:
~/public_html/sites/another-domain.com:8080
do you mean to imply that we can specify which ports drupal will respond to? Or do we need to specify the 8080 port for it to work properly?
thanks...
You may
Some hosts require Drupal to respond to a non-standard port address. For those cases, you may specify the port. The vast majority of sites do not need this. If you don't, the best thing is to leave it off.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
How: 3 unique 'frontpages' - for sub-website/domain?
Hi,
I'm newbie. Aready created a few articles. My question, sounds simple but already a week cannot find solution: The default front page is fine. From there I''m creating links to totally unique 'front page' for each 3 unique sub-websites (independent sub-domain?). Problem is..if I use the create article or basic page, the same default frontpage image header & title automatically displayed; i.e. all page created is truly content page. Also, 'Home' link will appear, I do not want this link-back to drupal default frontpage. Hope someone can help. TQ.