example.sites.php

  1. drupal
    1. 7 drupal/sites/example.sites.php
    2. 8 drupal/sites/example.sites.php

Configuration file for Drupal's multi-site directory aliasing feature.

This file allows you to define a set of aliases that map hostnames, ports, and pathnames to configuration directories in the sites directory. These aliases are loaded prior to scanning for directories, and they are exempt from the normal discovery rules. See default.settings.php to view how Drupal discovers the configuration directory when no alias is found.

Aliases are useful on development servers, where the domain name may not be the same as the domain of the live server. Since Drupal stores file paths in the database (files, system table, etc.) this will ensure the paths are correct when the site is deployed to a live server.

To use this file, copy and rename it such that its path plus filename is 'sites/sites.php'. If you don't need to use multi-site directory aliasing, then you can safely ignore this file, and Drupal will ignore it too.

Aliases are defined in an associative array named $sites. The array is written in the format: '<port>.<domain>.<path>' => 'directory'. As an example, to map http://www.drupal.org:8080/mysite/test to the configuration directory sites/example.com, the array should be defined as:

$sites = array(
  '8080.www.drupal.org.mysite.test' => 'example.com',
);

The URL, http://www.drupal.org:8080/mysite/test/, could be a symbolic link or an Apache Alias directive that points to the Drupal root containing index.php. An alias could also be created for a subdomain. See the online Drupal installation guide for more information on setting up domains, subdomains, and subdirectories.

The following examples look for a site configuration in sites/example.com:

URL: http://dev.drupal.org
$sites['dev.drupal.org'] = 'example.com';

URL: http://localhost/example
$sites['localhost.example'] = 'example.com';

URL: http://localhost:8080/example
$sites['8080.localhost.example'] = 'example.com';

URL: http://www.drupal.org:8080/mysite/test/
$sites['8080.www.drupal.org.mysite.test'] = 'example.com';

See also

default.settings.php

conf_path()

http://drupal.org/documentation/install/multi-site

File

View source
  1. <?php
  2. /**
  3. * @file
  4. * Configuration file for Drupal's multi-site directory aliasing feature.
  5. *
  6. * This file allows you to define a set of aliases that map hostnames, ports, and
  7. * pathnames to configuration directories in the sites directory. These aliases
  8. * are loaded prior to scanning for directories, and they are exempt from the
  9. * normal discovery rules. See default.settings.php to view how Drupal discovers
  10. * the configuration directory when no alias is found.
  11. *
  12. * Aliases are useful on development servers, where the domain name may not be
  13. * the same as the domain of the live server. Since Drupal stores file paths in
  14. * the database (files, system table, etc.) this will ensure the paths are
  15. * correct when the site is deployed to a live server.
  16. *
  17. * To use this file, copy and rename it such that its path plus filename is
  18. * 'sites/sites.php'. If you don't need to use multi-site directory aliasing,
  19. * then you can safely ignore this file, and Drupal will ignore it too.
  20. *
  21. * Aliases are defined in an associative array named $sites. The array is
  22. * written in the format: '<port>.<domain>.<path>' => 'directory'. As an
  23. * example, to map http://www.drupal.org:8080/mysite/test to the configuration
  24. * directory sites/example.com, the array should be defined as:
  25. * @code
  26. * $sites = array(
  27. * '8080.www.drupal.org.mysite.test' => 'example.com',
  28. * );
  29. * @endcode
  30. * The URL, http://www.drupal.org:8080/mysite/test/, could be a symbolic link or
  31. * an Apache Alias directive that points to the Drupal root containing
  32. * index.php. An alias could also be created for a subdomain. See the
  33. * @link http://drupal.org/documentation/install online Drupal installation guide @endlink
  34. * for more information on setting up domains, subdomains, and subdirectories.
  35. *
  36. * The following examples look for a site configuration in sites/example.com:
  37. * @code
  38. * URL: http://dev.drupal.org
  39. * $sites['dev.drupal.org'] = 'example.com';
  40. *
  41. * URL: http://localhost/example
  42. * $sites['localhost.example'] = 'example.com';
  43. *
  44. * URL: http://localhost:8080/example
  45. * $sites['8080.localhost.example'] = 'example.com';
  46. *
  47. * URL: http://www.drupal.org:8080/mysite/test/
  48. * $sites['8080.www.drupal.org.mysite.test'] = 'example.com';
  49. * @endcode
  50. *
  51. * @see default.settings.php
  52. * @see conf_path()
  53. * @see http://drupal.org/documentation/install/multi-site
  54. */