Hi

in Drupal 4.6, to craete a new site, I must add a subdirectory, under /sites directory, name it same after the new site's name, and add a setting.php file with the new site's own database info in it.
My question is: how can I create a new site that uses a subdomain?
For example, if the main site is in:
http://domain.com/drupa/ ..and I want to create a new site, in:
http://sub.domain.com
I'm using cPanel. Do I have to create the subdomain first? or is that not neccessary?
and do I just leave the subdomain directory, created by cpanel, empty?

Comments

Steve Dondley’s picture

I can't tell you what menu items you have to select via cPanel. But cPanel is just a GUI for the Apache server. So I can tell you that all you need to do is make the "DocumentRoot" directive in the Apache httpd.conf file point to the directory that contains the Drupal code. So, for example, you httpd.conf file would look something like this:

...
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName domain.com
DocumentRoot /home/drupal
....
</VirtualHost>
...
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName sub.domain.com
DocumentRoot /home/drupal
....
</VirtualHost>

Notice that the DocumentRoot is the same for both sites.

Once you make the changes to this file, don't forget that you need to restart the server (not sure how cPanel handles this. It might be done automatically.).

sallam’s picture

Apologies for not stating this earlier, but I'm on shared hosting, so I have no root access. Can I do something similar in my account? I only have access to:
/home/account_name/
and:
/home/account_name/public_html/

Steve Dondley’s picture

It's been a long time since I've used cpanel, but I should think there is still a way you can configure the DocumentRoot directive. Talk to you webhost. They should be able to give you specific steps.

adrian’s picture

the new site directory 'sub.domain.com'

and add it's settings directory there.

--
The future is so Bryght, I have to wear shades.

jasonwhat’s picture

I tried this and just get a internal server error. Do you mean, first create the subdomain in cpanel, then change the directory name from, "sub," to "sub.domain.com." Then, put the settings file in that directory named settings? I've tried a few ways and had no luck so any step by step of how you've got this workig is appreciated.

garm’s picture

just letting you know that you are not the only one with issues concerning multi sites it looks straight forward but we just cant get it to work on one drupal installation and we´ve been over every single thread i could find in the forums and of course the handbook so a very detailed step by step would be nice but im starting to believe that there´s something else thats the issue for us(htmlarea refuses to work aswell even tho fck and tiny is working perfectly).

However a detailed step by step would be nice if someone could take the time.

jasonwhat’s picture

I figure someone must have figured out how to do this. It is quite easy with a top level domain, but seems impossible with a subdomain because the subdomain points to a new directory in the root, rather than being parked on the root.

jadwigo’s picture

You need a subdomain that points back to the same directory as your normal drupal install.
So if cPanel only lets you create a subdomain pointing to another directory, call the helpdesk of your webhost and ask them to create it. There might of course be extra costs for a change like that, but most webhost I know just create it for you.

stevryn’s picture

When you created a subdomain in CPanel it creates a folder, remove that folder and have your host (if you cannot do this yourself) create a symbolic link to the root directory of your drupal install, named the same as the folder you deleted:

for example if:
My domain is www.mydomain.com
I create subdomain called subdomain.mydomain.com, and CPanel creates a folder called "subdomain"
I delete that folder, and ask my host (I dont have shell access) to create a symbolic link called "subdomain" to point to the root directory where drupal codebase is.

NOTE: once they create it, it may appear to you that the folder is back..it is *NOT* the folder, it is the link, dont delete it!!

You still need to follow drupals instructions:
under the root install of drupal....under your sites directory create a folder named (using the example above) "subdomain.mydomain.com". Place a copy of the settings.php file here, and edit it with your new sites information, ie db info, & base url.

It is a good idea to also create a seperate folder for your new sites files (images etc) this way they dont step on each other.

sallam’s picture

I didn't check here for a long time.
Can someone please let me know if its now possible, in the new verion, to create multi sites, either as subdomains, or as different domain names?

CMS matrix (at: http://cmsmatrix.org/matrix/cms-matrix?func=viewDetail&listingId=1050) they say Drupal is now both sub-site and multi-site capable. But I don't find it mentioned in Drupal features page here.

stevryn’s picture

I have done exactly what you are talking about and it finally works. I use 4.6.3