Drupal: select theme by domain / HTTP_HOST

Sometimes, it may be helpful to select a Drupal 6 theme depending on the domain being used for every request. Although there are full-fledged solutions like Domain Access, they may be considered overkill for this problem.

A reliable and quick solution is a custom module which is also compatible to a multisite drupal installation. Let’s call our sample module fooselect. Then create the directory fooselect either in /drupal/modules/ or /drupal/site/DOMAIN/modules/. Add the two following files to this directory:



After activation of this module, you have to adjust the second file to suit your needs, in particular the selection logic, the theme name and the domain names.

Leave a comment

Your e-mail address will not be published.