I want to setup multiple drupal sites using different subdirectories instead of domain names or IP addresses. For example, if my main drupal site right now is http://host.domain.com. I want to create another independent site with the root address of http://host.domain.com/site2.

I know I need to create a config directory in sites/host.domain.com.site2/ and put seetings.php there, but what do I put in http://host.domain.com/site2 directory? There must be at least an index.php there.

Also, do I need to create a separate MySQL database? I thought I could use the $db_prefix, by using a different prefix for each site, but when I do that, I end up with a blank page (I also did a symbolic link of the root html directory to the site2 directory). If I remove the $db_prefix, I end up back at the main site (this is with the symbolic link). And obviously, if I remove the symbolic link, I get an HTTP page not found error since the site2 directory is empty.

Any help you can give me would be great.

Thanks,
Kory

Comments

BoogieBug’s picture

What I have done is creating symbolic link of all Drupal files, except index.php and .htaccess in the subdirectory.

If you want to use different modules and don't want to put it together, you might need to create a real "modules" directory and make the symbolic link of the files, you want, in main modules into this directory, and then place the additional modules into it.

bonobo’s picture

one database for each site.

For instructions on how to create multisites, including instructions on symbolic links, check out this thread.

Hope this helps,

Bill

-------
http://www.funnymonkey.com
Tools for Teachers

alchemist’s picture

OK, I think I did what the thread stated, but when I go to http://host.domain.com/site2, I get a blank page. Here is what I did:

1. Created a new database called "site2".
2. From the root drupal directory I did a "ln -s . site2".
3. I copied the settings.php to sites/host.domain.com.site/
4. I set the news database name in the $db_url string.
5. For $base_url, I left is what it was (http://host.domain.com) and I tried http://host.domain.com/site2. They both created the same result: blank page.

What am I missing? Based on the other threads, this is all people had to do.

Thank you for your help and patience!

Regards,
Kory

bonobo’s picture

change the file name in sites to host.domain.com.site2

As it reads in your post, you omitted the 2 in site2

This also assumes you have another drupal site at http://host.domain.com, and that the settings.php file for that site is in the "default" directory within "sites".

I hope this helps.

Cheers,

Bill

-------
http://www.funnymonkey.com
Tools for Teachers

pamphile’s picture

Can this work without symlinks on windows ?

Marcel
http://writers-wanted.com

alchemist’s picture

Bill,

That was just a typo in the post. The actually directory path is sites/host.domain.com.site2. I have the following config files:

sites/default/settings.php
sites/host.domain.com/settings.php
sites/host.domain.com.site2/settings.php

Any clues?

Thanks,
Kory

bonobo’s picture

and hoping it wasn't, 'cause that would have made it easy :)

These instructions assume apache running on linux.

So, from what you have described, you want three sites.
One at http://www.domain.com (the "default" folder in "sites";
another at http://host.domain.com;
and a third at http://host.domain.com/site2

To create these sites, you would install drupal in the root of your public_html directory (so that index.php is in public_html/index.php)

Then, you would use cPanel to create the host.domain.com subdirectory (cPanel makes things easier because it automates the necessary changes in your httpd.conf file). Using your ftp client (or from the command line), you would delete the "host" directory, and create the symbolic link to "host" in your public_html directory.

For the site at http://host.domain.com/site2 site2 directory, try creating the symbolic link to site2 in the public_html directory -- you don't need a "site2" directory at all -- the symbolic link takes care of that.

One other thing to check is that the subdomain host.domain.com resolves to the same IP as domain.com -- this would be a DNS issue, and from what you've described is not a likely candidate for the problems you've been having.

I've never actually tried to set up a multisite off one codebase where I combined subdomains with subfolders from the same codebase -- I've always done either all subdirectories or all subfolders, so, while this is how I would go about it if I was setting it up myself, I can't say from my direct experience that this will work.

I hope this helps (and works!).

Cheers,

Bill

-------
http://www.funnymonkey.com
Tools for Teachers

alchemist’s picture

Bill,

Once again I wasn't clear on my setup. I want two sites. One is already working (www.domain.com) and I can't get the second to work (www.domain.com/site2).

I thought I needed once setting.php for each site and a default one, that's why I have three setting.php.

Do I need do mofidy my httpd.confg to do this? I was told that a symbolic link would be all I need.

I'm normally not this stupid. Really. I swear.

Kory

bonobo’s picture

You will need two directories in "sites". The default directory will be for the main site: http://www.domain.com

The second directory -- domain.com.site2 -- will be for http://www.domain.com/site2

And, within the two directories in your "sites" folder, you will have a settings.php file configured correctly.

In your case, you want to put the symbolic link inside the "drupal" folder (public_html/drupal) because you have set up the redirect from public_html to point to public_html/drupal

That should do it.

You should not need to modify httpd.conf to get this done.

RE

I'm normally not this stupid. Really. I swear.

No worries. Ask as many questions as you need. Maybe one of these times I'll actually explain what you're looking for :)

Cheers,

Bill

-------
http://www.funnymonkey.com
Tools for Teachers

alchemist’s picture

I did get it working. I turned on PHP loggin and realized I had never granted permissions to the database for the 2nd site. That was the main problem. By default, PHP does not log any errors, so you just end up with a blank page when anything goes wrong.

Thanks again, everyone, for you help and patience.

Kory