Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This branch needs a going over for deprecatable/archivable content. Feel free to update/deprecate as needed.
Instructions on multi-site configuration (also known as "multisite" and "single code base" installations) can be found within the installation instructions.
Comments
Drupal 5.1 Multi Site Configuration
Example:
1. Create dns entries for the sites ( or use hosts file for testing)
2. Create vhosts in Apache configuration file and restart Apache:
3. Create folder sites under drupal/sites
www.site1.local
www.site2.local
Note: Each site folder can have a file, tmp, modules and themes subfolders.
4. Copy settings.php from drupal/sites/default to each site folder.
5. Modify $db_url and $db_prefix in settings.php in each site folder.
For www.site1.local: Single database and db user.
$db_url = 'mysql://drupal:drupal@localhost/drupal';
$db_prefix = 'site1_';
For www.site2.local: Single database and single db user.
$db_url = 'mysql://drupal:drupal@localhost/drupal';
$db_prefix = 'site2_';
For www.site1.local: Multiple databases and single db user.
$db_url = 'mysql://drupal:drupal@localhost/site1';
$db_prefix = '';
For www.site2.local: Multiple databases and single db user.
$db_url = 'mysql://drupal:drupal@localhost/site2';
$db_prefix = '';
Note: Always use the same db user (the one that you used to install drupal for the first time) independently if you want to have a single or multiples db’s.
6. Open your web browser and point to the install.php file for each site
http://www.site1.local/drupal/install.php
http://www.site2.local/drupal/install.php
7. Your new sites are ready using a single code base, single db user and single or multiple db’s.
http://www.site1.local/drupal/
http://www.site2.local/drupal/
Drupal 5.1 Multi-Sites Configuration -- comment
ant01's description is extremely helpful and cogent.
It appears that the instructions contemplate that each site has other content not controlled by Drupal. Thus, www.site2.local and www.site2.local/drupal would have different content. Perhaps the site owner has a static page for product information at the root URL, and the Drupal site is for employees, vendors, or customers.
However, for many of us, Drupal serves all content. If one wants the content for ALL traffic for www.site2.local to be served by Drupal, the following changes would be made:
Step 2: Add "/drupal" to the end of the DocumentRoot statement, so that it reads:
Step 6: Remove "/drupal" from the path to install.php, so that it reads:
http://www.site2.local/install.php
Step 7: Remove "/drupal/" from the URL:
http://www.site2.local
Depending on your configuration, you may also need to change the RewriteBase from "/drupal" to "/". RewriteBase might be found in your Apache (or other httpd) configuration files or in htaccess, again depending on your configuration.
If you want to have non-Drupal content, but you want the Drupal content to be the default, use RedirectMatch:
The RedirectMatch alternative would still use "/drupal" in the URL of the Drupal site. The URL of www.site2.local would be redirected to www.site2.local/drupal. If the site had other content, such as www.site2.local/foo, content from "C:/Program Files/xampp/htdocs/foo" would be served.
Loye Young
http://www.iycc.net
Laredo, Texas
minor multi-site clarifications
Some minor clarifications for us neophytes
if you get
Warning: Table 'drupalsite1dbnamehere.access' doesn't exist query: SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM access WHERE type = 'host' AND LOWER('127.0.0.1') LIKE LOWER(mask) ORDER BY status DESC LIMIT 0, 1 in C:\drupal\includes\database.mysql.inc on line 172
you went to
http://www.site1.local/drupal/
instead of
http://www.site1.local/drupal/install.php
Also, my hosts file got corrupted while messing with this, which may or may not be related to my mucking around with XAMPP and C:\WINDOWS\system32\drivers\etc\hosts, but if you can't seem to figure out why you can't go to http://www.site1.local/drupal, try recreating your C:\WINDOWS\system32\drivers\etc\hosts file. The entries should be
Here's a variation of the httpd.conf file entries that works for me (note the / instead of the \ in the path name)
Drupal Multi Site with Direct Admin
Hello,
here's how to do that with Direct Admin:
- create a subdomain in Direct Admin example: sub.example.com
- you have a subfolder in public_html, delete that folder with the contents
- chmod only the public_html folder to 777 to create the symlink
- create a symlink between public_html and the name of the sub = sub
upload ln.php to the public_html folder and go to http://www.example.com/ln.php
- make a new database in Direct Admin
- copy the /sites/default folder to /sites/sub.example.com
- edit settings.php and correct the database settings
- go to http://sub.example.com, you get errors with table not found, that's good!
- go to http://sub.example.com/install.php and run the install
- That's it!
- to delete a link upload unlink.php to public_html folder
- chmod only the public_html folder to 777
- run http://www.example.com/unlink.php and that's it.
Here's the php code to create the symlink:
Here's the code to unlink the symlink:
Drupal 6 Multisite - Variable Overrides, Pathauto, mod_rewrite
Let's say you want to use a single Drupal install to run your company's primary web site and your company's blog site (multisite), but you also have different themes and navigation hierarchies for the two sites. Sure, there are some Drupal modules that may provide most of this functionality. However, you can accomplish exactly the same thing with a plain vanilla Drupal install and the Pathauto module (a module that you should really be using anyways).
Check out the rest in my blog entry at: Drupal Multisite
Don't forget to change the RewriteBase
If you're installing the second site in a sub-directoy, don't forget to change the RewriteBase in .htaccess. Here are the instructions that worked for me from http://drupal.org/getting-started/clean-urls:
In an effort to host multiple
In an effort to host multiple sites using urls like http://www.mysite.com/drupal_1 I found I needed to have Alias's and rewrite rules for each sub-site in my vhost file:
Alias /drupal_1 /var/www
Alias /drupal_2 /var/www
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal_1/(.*)$
RewriteRule ^(.*)$ /drupal_1/index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/drupal_2/(.*)$
RewriteRule ^(.*)$ /drupal_2/index.php?q=$1 [L,QSA]
Here's a helpful page explaining Drupal multisite in subfolders.
Multisite - Internal Server Error - .htaccess RewriteBase
In the same line of thought, if you use a subdomain for multisites, remember to 'hash' the following .htaccess option:
# RewriteBase /my_drupal_install_folder
Since my Drupal installation is in a subdirectory, I had activated this part in .htaccess :
RewriteBase /my_drupal_install_folder
My multisite subdomain dev.mysite.org has as root /my_drupal_install_folder, so it made no sense for the .htaccess to call for /my_drupal_install_folder
Once I added # before RewriteBase, all worked fine.
Nb - Tip : To create my multisite tables, I simply create a new database and use the phpMyAdmin option to copy all tables to another database. By doing this, you suddenly have an exact copy of your production site! But you'll need to flush all caches for your new multisite (ex.: dev.mysite.org) to work.
Michael Lessard
webmaster of Quebec City "democracy in action" media
Mutisite install of Drupal 7 on an Ubuntu server
Please see my post at http://drupal.org/node/1032286#comment-4110298 for a D7 multisite install.
simple drupal 7 multi-site configuration
drupal 7 multi-site configuration is very simple, all you need is to read and understand the sites.php
Converting single site to multisite
http://drupal.org/project/multisite_wizard - for D7
There is an alternative
There is an alternative Drupal-multisite setup done by Drupion: http://drupion.com/resources/general-information/multi-site-directory-an...