I just installed 6.3 today and one of the first things I noticed is how easy it is to setup multisite configurations. All you have to do is setup a wildcard subdomain [*.example.com] and redirect it to your drupal installation directory. Next, you just create a duplicate of your /sites/default directory and rename it to [sub.example.com]. Yes, the directory name is the full address of the subdomain you wish to use. Instead of copying the /sites/default directory, I prefer to make my own naming it [sub.example.com]. Inside this directory, I placed a copy of default-settings.php and renamed it settings.php. I then created the /sites/sub.example.com/files directory. It won't work without that folder in place. Finally, I changed the chmod setting to match the /default directory.
How this works is anytime a subdomain is entered ex. [sub1.example.com or sub2.example.com] the wildcard subdomain redirect [*.example.com] routes to the drupal install directory. Let's say you have the directory setup for /sites/sub1.example.com then drupal will automatically route to that site. If you don't have a directory for sub2.example.com it will automatically route to your default site.
So that was the good. Here is the downfall and maybe someone can help me with this. I am a newbie here at drupal. When I set up my multisites most of the configuration settings in the Administer menu disappeared not just for the subdomain but for the default site as well. If there is a way to still reach these settings then there is no problem. However, this is a big problem for me. Does anyone have any information on this? Thanks.
Justin
Comments
Good tip re - wildcard
Good tip re - wildcard sub-domain pointing to drupal directory, I'll try it out later, but then I've only got two sub-domains to worry about.
I'm not completely sure what you're trying to explain but I'll take a guess and assume you're not seeing any of your contributed modules. Place all your themes and modules under the "all" folder of "sites" and that way each of your separate domains and sub-domains will at least have access to them, that is, clicking on the "modules" link you'll at least see them. For each separate domain/sub-domain you then fiddle and configure to your heart's content and any settings made are independent of your other domains/sub-domains.
___________________________
Steven Taylor
http://prime357.org
/sites/all/modules
All of my modules are in the /sites/all/modules directory and they are not appearing in the Administer Menu. This is the problem I am having. Before I set up the subdomain I could see all the settings pages for my modules and after I added the subdomain I couldn't see them all, just some of them.
Justin
No Administive items.
Now when I try to open administer it says that I have no administer items. I can't seem to figure this out. I deleted my subdomain and I'm still getting this issue.
> I can't seem to figure
> I can't seem to figure this out
1)
By copying the chmod for the default install, you stopped drupal from writing to the settings.php file.
The sites folder, and all files and folders under it, should be 755 during set-up. Drupal will automatically chmod them to 555 again when the site starts being used after the install process.
2)
When you first visited your subdomain, did the install process start?
Each multisite needs to go through its own install process.
To instigate the install process, replace your subdomain's settings.php with a BLANK file called settings.php
3)
Each multisite is supposed to be separate. The way you set it up (all sites sharing the same database without any prefixes) is not how it's supposed to work, and you're probably right to guess that this is why your site is broken. When you go through the install process for each multisite (which you don't appear to have done), you either set a different database for each one, or share one database using prefixes. AFTER you have it set-up and working, you can then go into the settings.php file and share parts of the database if you need. Eg. sharing the user-related tables, so users have the same account at each multisite (but note this is not the same as 'single-logon').
Personally I think that your site is completely hosed with a corrupted database, and I'd start off with a fresh install rather than try to fix it.
DB Prefix
I think the reason I started to have these problems is that there should be a db prefix for the subdomains.
I'm not a programmer and don't know a whole lot about drupal, but from what I've read and looking through the settings.php and install.php it looks it is possible to create a module that creates subdomains. By taking a modified install.php and the default setting.php it looks like you could create a module that asks for the subdomain [ ].example.com. Then ask if they would like to share the users data base with the default site or a previously installed subsite. Then submit. When submitted, the modified install.php (renamed ofcourse) can create the new directory sub.example.com like follows:
/sites/sub.example.com/
/sites/sub.example.com/settings.php
/sites/sub.example.com/files/
Then the intall file can take the subdomain inserted into the form and create tables in the database for a db_prefix sub_. If the share users field is filled then the install could create an db_prefix array linking the users to the proper db_prefix. Like I said before, I'm not a programmer. I wish I was. Please let me know if this is possible and if anyone is interested in setting something like this up.
From here things could get really interesting and a module could be made for complete administration of all subdomains from the default website. The module could allow for permissions to modules and themes depending on the site even though all themes and modules are stored in the /sites/all/ directory. This could also include Add-on domains. Databases could also be shared based on permissions. Hope I've inspired someone. Please let me know what you think.
> it looks it is possible to
> it looks it is possible to create a module that creates subdomains
Have you seen the Domain Access module?
Or the Virtual Sites module (D5 only)?
> From here things could get really interesting and a module could be made for complete
> administration of all subdomains from the default website
That kind-of defeats the purpose of multisites, which are supposed to be separate sites in all respects, except they use 1.5mb of files in total instead of 1.5mb for each install. I think you are probably looking for something more like the Domain Acess module, rather than the multisite feature.
I guess so. I had that
I guess so. I had that installed before but I guess it didn't work properly and I forgot about it. Plus having to access the shell was another issue. I'll give it another shot.
So after much tinkering and
So after much tinkering and the such I think that the subdomain module works great if you just want to have multiple subdomains related to your site. If you want to have subdomains that are not related to your site as much, example hosting sites and having different themes and modules etc. I think I have come up with a solution however I am not a programmer so this will require some help is someone is interested. I don't think a module would be the best way to go about this, but a completely seperate page such as update.php. Here is my solution.
Create a 'subsite.php' that displays a page that only the admin or uid 1 account from the core installation can access (similar to update.php). On the page displayed have a list of existing domains with edit and delete options and a field to add new domains. On the add domain field ask for the sub site's full domain address minus the 'http://' and a preferred db prefix. When they enter the db prefix make the prefix 'subprefix'. This should help eliminate conflicts. If either field already exists show an error and require the user to change it. Same with the edit form. Also, have fields to generate the admin or uid 1 account for the new subsite. When the add sub site form is submitted the .php should automatically create a directory in the sites folder with the exact same name as the sub site url with modules and themes directories, create a modified settings.php with the correct db prefix settings in the sub site url directory, and create the tables with the db prefix in the database. This would allow for the easiest creation of subsites including subdomains and parked domains. Drupal 6 already searches automatically for the correct site submission. Also, this allows the sites to only share the core modules and themes and modules and themes in the '/sites/all' directory.
If this file existed, making a new subdomain or parked domain would be as easy as the steps below.
1. Create subdomain '*.yoursite.com' and leave it 'Not Redirected' or redirect it to your core installation directory. This is done with your hosting provider. The '*' is a wildcard allowing for all undirected subdomains to point to your core drupal installation. If you create a parked domain 'yoursite2.com' you should also add this the wildcard subdomain '*.yoursite2.com'. Parked domains and parked domains subdomain wildcard should also be 'Not Redirected' or point to your drupal core installation directory. **The subsite.php might even be able to include this step.**
2. Open 'http://yoursite.com/subsite.php'. Complete the add subsite form.
3. Start developing your new subsite.
Please let me know what everyone thinks. Like I said I'm no programmer but with the advanced feature already in drupal I think this is an ideal solution for the easiest creation of subdomains and parked domains. Plus this allows each subsite to use its own modules and themes without affecting the core installation or any other site.