I was setting up a static mobile website for a Drupal site that was installed within the Aegir hosting environment today. We had been given a static mobile version of the website to load. So, we added the mobile site to a directory within our theme and we needed to setup an alias for this site. To accomplish this we created a new mysite.drush.inc file within the .drush folder and added the following code:
function MYSITE_provision_apache_vhost_config($uri, $data) {
if ($uri == 'www.MYSITE.com'){
$mobile_path = d()->site_path . '/themes/MY-THEME-PATH/mobile-directory';
return array(
'',
'# Mobile site alias setup',
'',
'Alias /mobile-site ' . $mobile_path,
'',
'',
' DirectoryIndex index.php',
'',
'',
'# End mobile site alias',
);
}
}
The key here is the d()->site_path
which will return the platform path that the current site is installed in. So, we won't need to update this whenever the platform changes.
References:
- http://community.aegirproject.org/dev-cheat-sheet