Hacks: XOOPS Multi Sites

Posted by: ldapguruOn 2004/1/22 13:26:08 12930 reads
Here's a way in which you can run multiple xoops instances with 1 simple XOOPS install.

This would be benefitial for those running XOOPS hosting servers. (saves diskspace and you could control caching independently for each XOOPS instance)

Here's a Step by Step procedure to do it.

1. Backup your existing mainfile.php

2. Copy mainfile.php to <yourdomain>.mainfile.php
eg: if your domain is www.ldapguru.net then copy mainfile.php to ldapguru.mainfile.php

3. Replace your existing mainfile.php with the following code:
<?php
if (!(isset($serverName))) 

$serverName $SERVER_NAME
$serverName str_replace("www.","",$serverName);
$serverName str_replace(".com","",$serverName); 
$serverName str_replace(".net","",$serverName); 
$serverName str_replace(".org","",$serverName); 

if (!(empty(
$serverName))) 

include(
$serverName."mailfile.php"); 
?>


4. Thats it !!!

An example instance is as follows:
If you want to run 1 XOOPS instance against the following 3 domains
www.domain1.com
www.domain2.net
www.domain3.net

You would create 3 files
domain1.mainfile.php
domain2.mainfile.php
domain3.mainfile.php

You could customize each file with it's unique URL. You could either keep the same database parameters (XOOPS_DB_HOST) or have unique ones. You could also have just 1 database with unique prefixes (XOOPS_DB_PREFIX) for each site.

the functionality is similar to what i have running on one of my non-XOOPS servers.

http://www.rohanpinto.com andhttp://www.chriselda.com are the same server, same hosting account and same content with the above script enabled. Remember these URL's are not running XOOPS, but rather the exact same process.


If you do not want to hack the code but download it, visit my XOOPS site athttp://www.ldapguru.net, I shall be posting a Multi-XOOPS-Site download shortly.