Aegir subfolder support

Update: Aegir subfolder support is apparently now in Aegir 2.x proper. See the ticket

About 2 and a half years ago, a feature request was made for the Aegir project to support the creation/management of '', '' subdirectory Drupal sites.

For various reasons, which you can read in the linked ticket above, this is not really that feasible in Aegir, largely due to the assumptions we have to make about a site having a valid, standalone URL and of being simply an 'instance' within a platform, as opposed to 'owning' a platform entirely.

However, Drupal itself supports this format of subdomain multisites, through a variety of hacks/rewrite rules and mappings.

I've recently had this requirement while building a prototype for a client and so have released an extension to Aegir called 'aegir_subfolders', based on several other attempts at resolving similar things by the likes of ComputerMinds, which attempts to handle these subfolder requirements automatically through the usual channels (Install, Verify, Migrate, Disable, Enable, Delete etc).

It is by no means finished - however, it does work, with some conditions (see the README.txt for the latest on these conditions, as they may make the following obsolete):

1. Do not use the feature if you plan on cloning any sites that you've declared to have a 'subfolder' alias, unless you patch your copy of Provision with the .patch file located in the aegir_subfolders git repository. The core Clone feature unfortunately has some baked-in logic that loads a site's context and making some changes before duplicating it. This seems not to be 'hookable' or injectable, so I had to 'nullify' the subfolder_path attribute within the Clone feature itself - just like how the Clone feature already does for Site Aliases. Hopefully this changes in future. I even tried to hack the existing site's alias 'just in time' before the attributes get loaded, but it seems that the d() object is already loaded and those changes aren't seen.

2. You can call your site's main URL anything you want. But to specify a subfolder, you must also then specify a 'Site Alias' that is in the format of (if you want to reach it at The feature will not work unless you do this.

3. You can only use this feature on Apache servers. No Nginx support right now, but patches welcome.

4. I haven't tested it with Drupal 5 sites, but it should work :)

5. You must have a valid vhost for your main '' site somewhere that Apache knows about. It can be nothing more than a vhost with 'ServerName' inside it. Having the domain just resolve via DNS to the server, is not enough, unless you feel like hacking Aegir and removing the 'Redirect 404 /' from /var/aegir/config/server_master/apache.conf.
The main domain should not be that of a Drupal site already managed by Aegir. I will change this constraint if I can get it to work..

As I said, the feature is not finished and probably contains bugs that could mess with your production sites. Please only use it in safe environments until it's been tested more, and don't blame me if something bad happens :)

Pull requests are welcome over on github.