Virtual Sites offers almost the same (and more) functionality as the Drupal multi-site feature without the need for the complicated setup of that feature. Depending on conditions (e.g. requested url or user role) handled by the Condition(s) module (bundled with Virtual Sites starting with the 7.x version), you can override theme, site information, menus and more to virtually present the visitor with a different website.

It is by no means limited to that, but one common example of where to use Virtual Sites is the mobile version of a site, intended to be viewed on mobile devices like smartphones or tablets. Using nothing else but Virtual Sites, you can set up all possible combinations of required functionality, like checking for:

  • a mobile browser (using the Browser condition);
  • a secondary hostname, eg. m.example.com (using the Hostname condition).

If any of the conditions above is met, you can:

  • switch the theme to a mobile-friendly one (using the VS Themes module);
  • even if the visitor used the regular URL, redirect them to the secondary hostname m.example.com (using the VS Common Settings module).

What it can do

  • Create virtual sites with different theme, site information, menus, etc.
  • No need for complex setup, like with Drupal's multi-site feature.
  • Determine when to show what site based on (sub)domain, path, user role, taxonomy or any other condition.
  • Add custom conditions by writing a plug-in for the condition module.
  • Add custom virtual site features by writing a plug-in.

Features a virtual site can have

Each virtual site can override the following settings of your default Drupal site:

  • Set the source for the primary links
  • Set the source for the secondary links
  • Set the default site language
  • Force a base URL (e.g. domain)
  • Add HTML, JS and CSS to the page template
  • Set all site information settings (admin/settings/site-information) like name, slogan and front-page
  • Set theme
  • Set all theme-specific settings (admin/build/themes/settings/theme) like logo and even settings offered by the theme itself
  • Any Drupal variable, using the easy INI syntax.

What it cannot do

For the following settings you'd still need Drupal's multi-site feature:

  • Database URL (DSN).
  • Table prefix(es).
  • PHP configuration and cookie_domain.
  • String overrides.

Drupal 7 version

Fokke kindly allowed me (djg_tram) to co-maintain the project as I ported it to Drupal 7. I still have the previous version running on D6 sites and will keep looking into eventual issues regarding the D6 version as well.

The D7 version is the Virtual Sites module and the Condition module it depends on rolled into one package. While it retains all the functionality from the D6 version (even added a new condition to check for the user's browser, useful to recognize visitors with mobile devices), changes in Drupal itself made its setup slightly different. Installing it will enable the dependent VS Conditions module automatically. The other, feature modules are optional, depending on your needs:

  • VS Common settings: provides common settings (links, language and base URL);
  • VS Head: provides page header elements (styles, scripts, etc);
  • VS Information: provides site information settings;
  • VS Themes: allows theme selection and overriding theme settings;
  • VS Variables: allows overriding variables.

Project Information

Downloads