I am trying to set up a second site in my existing Drupal installation . . . you know, 1 Drupal code base and 2 separate sites with 2 separate databases. I tried to follow the information I picked up from various posts, things did not proceed exactly like any of the ones I read, nonetheless I managed to get the 2 installation completed with the 2 databases filled with the 46 tables created by the installation process.

My set up is like this . . .
* Main site:
Site Name: Drupal Main
Location on server: mydomain.com/drupal/sites/default/
* 2nd site:
Site Name: testdrupal
Location on server: mydomain.com/drupal/sites/testdrupal.mydomain.com
(NOTE: This 2nd site is actually a subdomain . . . testdrupal.mydomain.com)

My current problem is that:
* when I type in the URL "http://mydomain.com/drupal/", my browser shows the front page of Drupal Main. Okay!
* when I type in the URL "http://testdrupal.mydomain.com, my browser still shows the front page of Drupal Main. No good!

Now, if I go into the "sites/default/" folder & replace the settings.php with the copy in "sites/testdrupal.mydomain.com/" folder, then:
* when I type in the URL "http://mydomain.com/drupal/", my browser shows the front page of testdrupal. Bad!
* when I type in the URL "http://testdrupal.mydomain.com, my browser still shows the front page of testdrupal. Okay!

Let me point out that, for the installation of the 2nd site, testdrupal . . . testdrupal.mydomain.com, I did set the document root of testdrupal.mydomain.com to mydomain.com/drupal (I use a feature called "redirection" on my host's Control Panel . . . and I hope that this is the correct way to do it.)

So it seems that regardless of the URL being typed in, Drupal only looks into the "settings.php" file in "sites/default/", & whichever settings it is, it simply calls up the site that these settings refer to . . . it doesn't know that there are 2 separate sites & it doesn't look into the "settings.php" file in "sites/testdrupal.mydomain.com".

Could someone point out what may be the problem(s) & what are the possible solutions?

Thanks in advance for your insights.
jc

Comments

kevin hankens’s picture

I'm not sure about the "redirection" feature you are using, but it sounds like when the HTTP request is processed it is redirecting testdrupal.mydomain.com to mydomain.com. So, regardless of what you type in, it's always sending the same domain name in the request.

Is there any way you can set up multiple domains in your control panel instead of a redirection?

Good luck!

jcWebDev’s picture

First, thanks for your reply, kevinhankens.

Yes, I was a bit suspicious of the redirection too . . . because it is like what you said, regardless of what URL I call up, if they are told to go to the same location, then that's where they will go, whether it be the first site or the 2nd site.

I've just gotten off Live Chat with my host about the redirection thing. I was told that I cannot set my document root for my 2nd site, "testdrupal.mydomain.com", to the first site, "mydomain.com/drupal". I was told that I can only use redirection. Now I am not all that hip with domain/subdomain administration . . . please tell me whether this is true in general.

jc

(PS, I do have separate domain/subdomains . . . I use subdomains because I am learning how to do this now & I don't wish to purchase a new domain just for experimenting around . . . I read that subdomains would do just fine for setting up another site within the same code base.

If I use a new, different, domain and try to set its document root to the first domain, then according to what my host told me, I still have to use redirection.)

kevin hankens’s picture

Yeah, that's the bummer with control panels - they make most of the tasks a lot easier, but they do restrict you from doing some things.

I'm using several subdomains for one of my D5 installs, and all I had to do was create VirtualHost stanzas in my Apache config that all pointed to the same directory, then as you've done, created /sites/sub.domain.com/settings.php for each one.

The answer might just be to look at a host that can offer more flexibility with multiple domains/subdomains.

Best of luck!

superjacent’s picture

Rename the default folder to 'xxxdefault' simply so you can rename it back to 'default' afterwards. Now check your system. I'm suspecting it wouldn't work. Make sure, under the sites folder that you have correctly created sub-folders corresponding to the names of your site(s) and in those folders will be the settings.php files.

I'm also assuming that the document root of all your sites points to the one location where drupal resides.
___________________________

Steven Taylor
http://prime357.org

dave reid’s picture

I'd also suggest leaving the default folder as it is from a clean install and use sites/domain.com and sites/subdomain.domain.com

jcWebDev’s picture

Thank you both for your insights, superjacent and Dave Reid.

I do have the Drupal directory/file structure like you said . . .
1st site: /mydomain.com/drupal/sites/default/
2nd site: /mydomain.com/drupal/sites/testdrupal.mydomain.com/

Now, the 2nd site, testdrupal.mydomain.com, is a subdomain created outside of the first domain . . . meaning if I view my file server with an FTP client, then both "mydomain.com" and "testdrupal.mydomain.com" are sitting under the root directory "/".

Should things look like this so far?

jc

dave reid’s picture

What are in each of those directories?

jcWebDev’s picture

Hi, Dave. Thanks for your continuing assistance.

The directories contain their respective "default.settings.php", "settings.php" files & "files/" folders.

That's all there is in them for now. Does it look correct?

jc

dave reid’s picture

Ok after re-reading your original post, it's a problem with the domain redirection. If test.domain.com redirects to domain.com, the location used to determine the current sites folder will only be domain.com. What you will need to do is "link" the test.domain.com directory to your mydomain.com/drupal folder.

First you will want to delete the redirection for test.domain.com in your control panel and set it up as it's own hosted domain (aka make sure test.domain.com) is now a blank domain. Then, you will need shell access to your site (ask your web host how to do this if you're unsure) and go to somewhere outside the Drupal folder to where you can see "domain.com" as a folder. Run the following terminal commands:

rm -rf test.domain.com
ln -s domain.com/path/to/drupal-folder test.domain.com

Note that if you want Drupal to run in a sub-folder of test.domain.com (e.g. http://test.domain.com/community) change the test.domain.com in the second command to the path you want it to be.

I hope that was clear enough for you!

jcWebDev’s picture

Hummm . . . by blank domain, do you mean absolutely no files are in there? Not even the initial files that came with the creation of the subdomain (or new domain) by the host?

If not that, then testdrupal.mydomain.com was blank, as in there wasn't a site on it . . . had one called up the URL, one would see the host's default page saying that the site was under construction. In another words, it was "parked" on the server but did not have a site yet.

In any case, I've been reading much about symlinking and the 2 commands in your post. I'll have to ask my host whether I can have shell access. Normally, I use a GUI interface like a control panel kind of thing. Because of this, I had asked the tech support at my host about setting/changing document root, & I was told that I cannot do it, & that I can only set a redirection for the domain from the control panel. I will go back & ask them specifically about shell access. If I have access to the shell, then I can follow the set-up directions to the dot.

Thanks again for your help :)
jc

war1237’s picture

I successfully set up multisite on two machines. On one of the machines, it works fine, but on the other I have some kind of "URL redirection" issue.

For example, if I type
o www.originaldomain.com/drupal/ -- my original Drupal site loads -- Good.
o www.seconddomain.com/drupal/ -- the second domain loads -- Good.
o www.originaldomain.com/drupal -- the original domain loads -- Good.

All good. BUT --

o If I type www.seconddomain.com/drupal (note missing ending slash), then the address in the URL line of my browser changes to www.originaldomain.com/drupal/ and -- unsurprisingly -- the original domain loads. Bad.

As I mentioned before, I do not have this problem on the machine where I have administrator privileges, and I am limited in my options on the machine that is having the issue. I suspect it has something to do with the way the second url is set up to point to the same directory as the original url, but I can't get a straight answer from the sys admin as to how the second domain is set up (ie, URL redirect, ln -s, etc) -- he believes this is a drupal issue, although I can't see where drupal would reset that url in the browser line.

Does anyone have any ideas, and, if so, can you tell me how to ask the sys admin the right questions?

Thanks!