Multi-site on Windows - using IIS
This guide assumes you have the following installed and running:
- Microsoft's Internet Information Services web server 6 or 7
- PhP 5.2 or higher with PDO dlls enabled.
- The IIS FastCGI Module (IIS6 version here - in IIS7 it's an integrated module that needs to be enabled).
- If you want clean urls, you'll also need the URL Rewrite module (IIS7) or a third-party url-rewrite module set up at some point, though you can do this afterward.
- Install a site. This will be the parent site, providing the code-base for all the child sites.
IIS7: be sure your parent site has a web.config file (see this for more info). Child sites will use the settings in the parent site's web.config file. To override these settings, put a web.config file with just the settings you want to override in the child site's folder (eg sites/site2.com/).
- Create child site folders. Decide how you want people to navigate to your sub-site. In the parent site's /sites/ folder, create sub-folders for each new site you wish to install.
- Example 1: parentsite.com/subsite/ - in parent /sites/ folder, create /sites/parentsite.com.subsite
- Example 2: subsite.parentsite.com - in parent /sites/ folder, create /sites/subsite.parentsite.com
- Example 3: subsite.com - in parent /sites/ folder, create /sites/subsite.com
IIS7 - Start the IIS Manager.
- Example 1: parentsite.com/subsite/ - Right-click on parentsite.com | Add virtual directory. Alias: [new site name, eg subsite]. Physical path: [parent site's physical path]. Click OK.
- Example 2: subsite.parentsite.com - Right-click on Sites | Add web site. Site name: [new site name, eg site2]. Click to select the application pool, and select the parent site. Physical path: enter the parent site's physical path. Host name: [new site url, eg site2.localhost]. Click OK.
- Example 3: subsite.com - add a web site as example 2, calling the host name subsite.com.
Multiple databases - If you want each site to have it's own database, create them now.
For each child site, change settings.php to include each site's database name, username, and password:
$databases['default']['default'] = array( 'driver' => 'mysql', 'database' => 'databasename', 'username' => 'username', 'password' => 'password', 'host' => 'localhost', );
Single database - See this tutorial.