function drush_sitealias_uri_to_site_dir

8.0.x drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)
6.x drush_sitealias_uri_to_site_dir($uri)
7.x drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)
3.x drush_sitealias_uri_to_site_dir($uri)
4.x drush_sitealias_uri_to_site_dir($uri)
5.x drush_sitealias_uri_to_site_dir($uri)
master drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)

Convert from a URI to a site directory.


uri: A uri, such as

Return value

string A directory, such as

8 calls to drush_sitealias_uri_to_site_dir()
drush_sitealias_alias_path in includes/
Return the array of paths where alias files are searched for.
drush_sitealias_alias_record_to_spec in includes/
Convert from an alias record to a site specification
drush_sitealias_get_record in includes/
Get a site alias record given an alias name or site specification.
drush_sitealias_local_site_path in includes/
Return the full path to the site directory of the given alias record.
_drush_sitealias_add_transient_defaults in includes/
Add "transient" default values to the given alias record. The difference between a static default and a transient default is that static defaults -always- exist in the alias record, whereas transient defaults are only added if the given…

... See full list


includes/, line 1589
The site alias API.


function drush_sitealias_uri_to_site_dir($uri, $site_root = NULL) {
  $uri = str_replace('http://', '', $uri);
  if (drush_is_windows()) {
    // Handle absolute paths on windows
    $uri = str_replace(array(':/', ':\\'), array('.', '.'), $uri);

  $hostname = str_replace(array('/', ':', '\\'), array('.', '.', '.'), $uri);

  // Check sites.php mappings
  $site_dir = drush_site_dir_lookup_from_hostname($hostname, $site_root);

  return $site_dir ? $site_dir : $hostname;