Drush site aliases offer a useful way to manage local environments without having to be within Drupal's root directory.
A site alias consists of an array of settings for Drush to access a Drupal project. They can be defined in different locations, using various file structures. You can find all of its variations at drush topic docs-aliases
. In this chapter, we will use the following variations:
We will define local site aliases at
$HOME/.drush/aliases.drushrc.php
, which are accessible anywhere for our command-line user.We will define a group of site aliases to manage the development and production environments of our sample Drupal project. These will be defined at
sites/all/drush/example.aliases.drushrc.php
.
In the following example, we will use the site-alias
command to generate a site alias definition for our sample Drupal project:
$ cd /home/juampy/projects/example
$ drush --uri=example.local site-alias --alias-name=example.local @self
$aliases["example.local...