Multi Sites

This guide shows one way of setting up multi-sites for Drupal using one code base and utilizing the accessibility module. A live example is available on the 227net domain - see related links.

In this synopsis I will describe the way that my server is set up and assumes that you can have the same sort of structure.

In this example, each separate site is a sub-domain.

  • wap.yourdomain.com
  • imode.yourdomain.com
  • mobi.yourdomain.com
  • pc.yourdomain.com

My host allows me to set up sub-domains manually by creating the sub-domain name then pointing the domain to an existing directory in my root directory.

To this end, I would create the names and point them all to the Drupal installation directory of my choice. For example:

wap
sub-domain name: wap.yourdomain.com
directory: /users/name/web_root/drupal
web
sub-domain name: pc.yourdomain.com
directory: /users/name/web_root/drupal


The next step is to create sites for these sub-domains. Based on the above, navigate to the /users/name/web_root/drupal/sites directory. There should already be a directory there called default.

As it stands, if a user navigates to wap.yourdomain.com they will still see the default site. Therefore, you can create a new directory in the sites folder called wap.yourdomain.com. Within that folder, make a copy of settings.php. Open this file and edit as you wish, but to make the site "wml" add the following lines at the bottom of the page:

define ('OVERRIDE', 'wml');
define ('IS_MOBILE', true);

Visitors to wap.yourdomain.com will now see a "wml" version of your site. Go through the creating and editing steps for each subdomain and change the definitions accordingly.

Additional settings can be administered here. In the live sites example listed in related links, the content is the same on each site, just reduced for hand-helds. Have a look at the $conf variable for more details. The site front page is a good example - this can be defined in the settings file.

$conf['site_frontpage'] = 'node_of_your_choice';

Note that although the principles are the same, the most recent versions of this module now require the following

define ('IS_MOBI', TRUE); // OR FALSE
define ('CONTENT_TYPE', 4); // NOT REQUIRED, BUT MUST MATCH KEY in $mime['content']

Syndicate content