remidian.com

play Mount of Olives

remidian is remi visser, oracle dba contractor from the Netherlands you can browse my work related braindumps, read my resume or contact me

home Misc Joomla!

Make Joomla! multi sites enabled.

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

readme

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.

httpd.conf
<VirtualHost 127.0.0.1>
 ServerName  joomla.remidian.localhost
 ServerAlias  *.joomla.remidian.localhost
 DocumentRoot  "C:/app/apache/Apache1/Apache/htdocs/Roomla_1.0.12"
</VirtualHost>

Step 2. configure hosts file

Next you need to adjust your ‘hosts’ file. You need to tell that your defined aliases will point to 127.0.0.1, 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, http://someonewhocares.org/hosts/)

C:\WINDOWS\system32\drivers\etc\hosts
# Joomla development!
127.0.0.1  joomla.remidian.localhost
 
127.0.0.1  christenenvoorisrael.joomla.remidian.localhost
127.0.0.1  isreality.joomla.remidian.localhost
127.0.0.1  tovclub.joomla.remidian.localhost
127.0.0.1  dragopecenica.joomla.remidian.localhost
127.0.0.1  neverbesilent.joomla.remidian.localhost
127.0.0.1  yadlami.joomla.remidian.localhost
127.0.0.1  ermelo.joomla.remidian.localhost

Step 3. Replace your $JOOMLA_HOME/configuration.php

Copy your existing configuration.php to $JOOMLA_HOME/_instance/<whatever-you-want>.php and replace the $JOOMLA_HOME/configuration.php by the file listed below.

<?php
/* $Id: configuration.php, v0.1 - 4/13/2005 18:06, 30c8981ef5b0c0d85be9695c19c184ee, http://remidian.com Exp $ */
 
$INSTANCE['christenenvoorisrael.joomla.remidian.localhost']     = "_instance/christenenvoorisrael.nl.php";
$INSTANCE['isreality.joomla.remidian.localhost']                = "_instance/isreality.nl.php";
$INSTANCE['neverbesilent.joomla.remidian.localhost']            = "_instance/neverbesilent.org.php";
$INSTANCE['tovclub.joomla.remidian.localhost']                  = "_instance/tovclub.nl.php";
$INSTANCE['yadlami.joomla.remidian.localhost']                  = "_instance/yadlami.org.php";
$INSTANCE['ermelo.joomla.remidian.localhost']                   = "_instance/ermelo.org.php";
$INSTANCE['dragopecenica.joomla.remidian.localhost']            = "_instance/dragopecenica.com.php";
 
// No trailing slash
$JOOMLA_HOME = "C:/app/apache/Apache1/Apache/htdocs/Roomla_1.0.12";
 
/**********************************************************
 * REV, 4/13/2005 18:06, NO MORE EDITTING PAST THIS POINT *
 *                                                        *
 **********************************************************/
 
$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 of 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.

No Comments, Comment or Ping

Reply to “Make Joomla! multi sites enabled.”