Ive got drush working on multiple sites with this in aliases.drushrc.php
<?php
$aliases = array(
'site1' => array(
'uri' => 'site1.com',
'root' => '/Applications/MAMP/htdocs/site1/docroot',
),
'site2' => array(
'uri' => 'site2.com',
'root' => '/Applications/MAMP/htdocs/site2/public',
),
);
This works great but im not only working on one site so id like to be able to leave out the site name when executing drush commands. So instead of drush @site1 cc
all I could just do drush cc all
. Can I do this within this file?
Try this,
$aliases['dev'] = array(
'root' => '/path/to/drupal',
'uri' => 'dev.mydrupalsite.com',
);
$aliases['prado'] = array(
'root' => '/path/to/drupal',
'uri' => 'dev.mydrupalsite.com',
);
then run following command,
drush @dev status
drush @prado status
Check here Demo Video
The key is the "drush use" command.
So if you set up an alias at ~/.drush/aliases.drushrc.php like
<?php
/**
* @file
* Site alias
*/
$aliases['local'] = array(
'root' => '/var/www/drupal/web',
'uri' => '0.0.0.0',
);
In your terminal type drush use @local
to be able to start using drush commands for your site outside of the project root without needing to specify @ which site every time, e.g. just using drush cr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With