Drupal multi-site setup with sub-directories - drupal

I have a multi-site setup with a single codebase.
Is it possible to have my sites directory set up like this with sub folders:
mysite.com in /home/drupal/sites/mysite.com
othersite1.com in /home/drupal/sites/cluster1/othersite1.com
othersite2.com in /home/drupal/sites/cluster1/othersite2.com
othersite3.com in /home/drupal/sites/cluster2/othersite3.com
othersite4.com in /home/drupal/sites/cluster2/othersite4.com
I'm trying to find a way to organize all my sites.
thanks

You can do this if you are using Drupal 7. There is a file called sites.php in sites folder that you can alias the paths to your sites. If you are using < Drupal 7 you can make the directories as you propose and create symbolic links
ln -s /home/drupal/sites/cluster1/othersite1.com othersite1.com
The way Drupal finds the site folder is explained in settings.php, read that.

Related

Reconfiguring Drupal for HostGator Site

I've tried researching this dozens of ways, and I've found posts that address pieces of what I'd like to do, but not the whole thing. I tried posting this on the Drupal forums as well, but my post hasn't shown up yet. I'm pretty new to Drupal and am afraid of corrupting my current site in the process.
Current setup:
I have a primary domain with several addon domains at HostGator
I want to convert one of my addon domains (call it addon.net) to a Drupal site
To test Drupal, I created a subdomain of addon.net (cmstest.addon.net) and used QuickInstall to set it up as a Drupal site
Current folder structure in HostGator:
/home1/[username]
cmstest.addon.net (contains Drupal files)
public_html
addon.net (contains html files)
What I'd like to accomplish:
I want to convert addon.net to a multi-instance Drupal site so I can have a test environment without having to maintain configuration and database changes in multiple places.
I don't want to lose the html files for the current addon.net site - if I have to back those up somewhere else just for reference, that's fine.
Ideally, I'd like to retain my current instance of Drupal as the main one and convert it to multi-instance, so I don't have to reconfigure everything from scratch.
If possible, I'd also like to retain the existing cmstest.addon.net domain as my test environment
I realize this is a lot of things, and I may have made things more difficult for myself by using QuickInstall rather than doing this manually. If it's much easier to start fresh with a manual install for addon.net and reapply all my changes once, that's still worth it if I can have a multi-instance setup with a test site moving forward.
Point all of the addon domains to the same folder in cPanel & then use standard Drupal multi-site installation techniques for the routing, i.e. the default domain plus individual folders and settings.php files for each of the subdomains.
Root: sites/default/settings.php
Domain: sites/example.com/settings.php
Subdomain: sites/sub.example.com/settings.php
Run the multi-site installation sharing the same core files, themes, & modules using this addressing format for the folders in /sites with unique settings.php files & MySQL databases (or table prefixes). You can also add unique /modules & /themes folders for each site if required.

Htaccess on XAMPP local server for testing

I finally got the XAMPP local Wordpress system working so now I can test things out.
If I want to mimic htaccess files to test redirect code and so forth - especially htaccess in the root - here would I put the htaccess file?
I'm thinking is the XAMPP folder considered the "root"? I've taken a snapshot of my directories to give you an idea. The checkmarks are there just to show you the general layout of the directories.
One other thing - suppose I wanted to create a sub-directory (like localhost/sub/index.php) to test in XAMPP. Is this possible? I noticed when I'm in local host there is no multi-site capability. Thoughts?
Thanks
The .htaccess file should be in the root of your WordPress installation and you may use sub-directories to create more local sites. For example:
localhost/wordpress = xampp/htdocs/wordpress/index.php
localhost/anothersite = xampp/htdocs/anothersite/index.php
// More...
For the WordPress installation, put the .htaccess in the wordpress directory in example (At the same level where the index.php file is stored).

Creating multiple sites with Drupal on LAMP/WAMP

I am confused as to how I can use Drupal to create multiple sites for a WAMP or LAMP installation.
I currently have everything setup and Drupal setup in the following directories:
/var/www/drupal-7.12
c:/wamp/www/drupal-7.12
When I access these folders from the browser I am able to modify and create content for my webpage.
It would appear to me that the default Drupal folder is the only one I can create my website in.
My question is: if I have multiple sites that I need to create with this one Drupal installation, how can I achieve it?
For example:
c:/wamp/www/mysite1
c:/wamp/www/mysite2
Thanks!
This document will explain a bit on how to run multiple sites from the same code base http://drupal.org/documentation/install/multi-site.
If your sites will share some common elements like users, this might also be helpful: http://drupal.org/node/201673
There may be more documentation written on the subject at Drupal.org, but most of what I can tell can be found in the following files. Be sure to read the comments in these files.
[Drupal Root Directory]/sites/example.sites.php
and
[Drupal Root Directory]/sites/default/default.settings.php
In general, the way Drupal 6 worked is that you needed to create subdirectories for each of your sites in the the sites directory. So that you would have a directory structure that looks like:
sites/default
sites/example-1.com
sites/example-2.com
etc.
I would imagine that D7 keeps this same structure, but I haven't yet It looks like the sites.php file provides a mapping of domain names and site directories that you can use to map. Drupal, will default to sites/default if it can't find an appropriate match.
While it's targeted toward linux, this might be a good place to find multisite info as well:
http://drupal.org/node/1114158

Drupal site folder naming scheme

When naming a sites folder in Drupal using a multi-site setup, can I name the site "mydomain" or does it have to be in the format of the domain name like "mydomain.com".
Is there a way to do this using symbolic link in linux?
thanks
Drupal matches the domain name requested via HTTP with the folder name inside sites. If it does not match anything it will fall back to "default". So you need to name the folder mydomain.com.
You can definitely use a symbolic link from mydomain.com -> mydomain provided your Apache (or other HTTPd) is configured to resolve symlinks.
Drupal 6 looks for a file named settings.php in a folder named sites/mydomain.com, or similar. The exact rules are listed in default.settings.php. If your host supports symbolic links, you could make mydomain.com into a link: the syntax is ln -s /path/to/real/files/mydomain mydomain.com
Drupal 7 is much nicer about how it handles multisite installs- it's possible to tell drupal where the settings.php file is for each domain. There's a patch that backports this feature here: http://drupal.org/node/231298

Drupal: how to set up multilanguage Drupal on several domains?

I need to set up Drupal 6 as a multilanguage site.
1 installation, several language versions = several domains, i.e.
English at englishsite.com
French at frenchsite.com
German at germansite.com.
I've found a Tutorial that suggest that you need access to server's http.conf - this is quite unlikely on shared hosting.
Is it really neccesary?
Maybe You can set it up with .htaccess or any other way.
Namely: what should I do to have such a configuration working ?
(after setting Language negotiation to Domain name only on .../admin/settings/language/configure)
According to what I've found this could resolved in at least 2 ways.
Admin interface
Make the domains point to the Drupal directory in the hosting account admin interface (what is equivalent to http.conf edit suggestion from the tutorial)
Symbolic links
Replace the domain-specific directories with symbolic links to the Drupal directory (in Unix-based systems), i.e.
ln -s <drupalDirectory> <domainDirectoryName>

Resources