Make Joomla! multi sites enabled.

  • Published on Aug 23 2007
  • # 1,438
  • Joomla!

Replace $JOOMLA_HOME/configuration.php with the file below and ‘off you go’, the Joomla! codebase can now serve multiple websites.


On my Joomla! development site (my PC) I have created a configuration.php to make my Joomla! codebase multi sites enabled, that is several website aliases (configured in my httpd.conf) point to the same Joomla! directory. (Needless to say, use it at your own risk.)

Of course there are some limitations (implications):

  • All configured websites share the same $JOOMLA_HOME/administrator/components, $JOOMLA_HOME/components, $JOOMLA_HOME/mambots and $JOOMLA_HOME/modules files thus de-installing a component, module or mambot from one website makes the component unavailable for all websites. The Joomla! installer removes the file from the operating system. But since the ‘de-install’ wasn’t run against the database on another website alias the component (module or mambot) may seemavailable in the administrator panel.

    Solution: I keep a keen eye on the components, modules and mambots I install and save (create) SQL files for manual (MySQL) installation and de-installation.

  • Since the $JOOMLA_HOME/configuration.php file is overwritten the use of the configuration panel in the Joomla! administrator sections can only be used for ‘read only’ access.
  • The images from $JOOMLA_HOME/images/stories are available to all websites. (I always create $JOOMLA_HOME/images/stories/<site-alias>) (If someone nows of a apache Rewrite trick to solve this please let met know!)

Step 1. configure apache httpd.conf file

My httpd.conf file looks like below, the ServerAlias *.joomla.remidian.localhost makes sure I can add as much aliasses as I want.

 ServerName	joomla.remidian.localhost
 ServerAlias	*.joomla.remidian.localhost
 DocumentRoot	"C:/app/apache/Apache1/Apache/htdocs/Roomla_1.0.12"

Step 2. configure hosts file

Next you need to adjust your ‘hosts’ file. You need to tell that your defined aliases will point to, your machine (localhost), otherwise your computer will look on the internet for these server names and well, won’t find it. (Yes, you can also use this ‘technique’ for ‘Ad blocking’, what you simply do is redirect every known add server to your pc. See an excellent file here,

/* $Id: configuration.php, v0.1 - 4/13/2005 18:06 */

$INSTANCE['example1.joomla.remidian.localhost'] = "_instance/configuration-example1.php";
$INSTANCE['example2.joomla.remidian.localhost'] = "_instance/configuration-example2.php";
$INSTANCE['example3.joomla.remidian.localhost'] = "_instance/configuration-example3.php";

// No tailing slash
$JOOMLA_HOME = "C:/app/apache/Apache1/Apache/htdocs/Roomla_1.0.12";

 *              *

$s_http_request     = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

$s_http_request_walk      = rtrim( $s_http_request, '/');

while ( $s_http_request_walk != '.'){

  // I will return the FIRST match ( from right to left )
  if ( array_key_exists( $s_http_request_walk, $INSTANCE)){
    if ( file_exists( $JOOMLA_HOME . '/' . $INSTANCE[$s_http_request_walk])){
      include( $INSTANCE[$s_http_request_walk]);
    } else {
      die( 'INS-001: Unable to retieve config file for know host \\'' . $s_http_request_walk . '\\'');

  $s_http_request_walk = dirname ( $s_http_request_walk);

if ( !isset( $mosConfig_live_site))
  die( 'INS-002: Unable to pass you a configuration file for unknow host \\'' . $s_http_request . '\\'');


chmod configuration.php

Make the $JOOMLA_HOME/configuration.php file read only. Otherwise one sorry update on one of your sites configuration in the administrator section will overwrite your ‘beautiful multisite enabling’ configuration.php, which, in fact, happened to me more than once, and, yes, that’s why I wrote this post serving as my own repository :).

Have fun with it.

Leave a Reply

Helpful? - leave your note below so I can brag

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>