Sunday, March 29, 2009

Multiple domains using the same database

Multiple domains using the same database
Drupal 4.5.x or olderLast modified: January 16, 2007 - 00:17
If you want to host multiple domains (or subdomains) on top of the same database (e.g. and, simply use symbolic links to setup the required configuration files:

$ ln -s sites/ sites/

$ ls -l sites
-rw-rw-r-- 1 drupal drupal sites/
lrwxrwxrrx 1 drupal drupal sites/ -> sites/

If your installation isn't in the root folder then you need to specify the path to the Drupal installation. For example if the URL to your installation is you would use sites/ with a settings.php file in it.

If you want cookies to be shared between two sites, you will need to set the value of PHP's session.cookie_domain correctly. In the case above, set it to "". You can do this through Drupal's .htaccess file.

No comments: