In some rare cases, you may want to run two (or more) different websites on a single Joomla installation, so you will have different databases but same filesystem. The reason for doing so is to maintain just one Joomla installation (e.g. upgrade, secure, host, etc…) instead of two ore more. At first glance, this seems to be impossible, but for those who are experts in Joomla, it’s feasible. We are fortunate enough that we had this request several times before, and here’s how we accommodated it:
- We copy the all the tables, and then we duplicate them in the same database with a different alias, for example, we use jos2_ instead of jos_ as the table alias for the new tables.
- We duplicate the configuration file. The new configuration file will be an exact copy of the original configuration.php file but with the small difference that instead of using jos_ as a table prefix it will be using jos2_ as the table prefix. We also modify the $sitename parameter, and optionally the $log_path and the $tmp_path parameters.
- We get the current website using the $_SERVER['HTTP_HOST'] defined variable.
- We modify the file /includes/framework.php and /administrator/includes/framework.php to point to the right configuration file based on the current website.
- We modify a few Joomla settings in the database (in the new created tables) based on the client’s request (for example, changing the title of the website, etc…)
That’s it! Yes, it’s not impossible, but it’s very delicate and can take some time for testing and for ensuring that everything’s OK. Note, for changing the template, the user can login to a website and change the template, and that change will not affect the template of another website.