This documentation is there to explain how to transform a classic postNuke into a multi sites one. There is almost nothing in the folder NS-Multisites, it is normal, almost everything is already in the core of postNuke, and some manipulations has to be done by someone qualified (not too much).

Our example is going to talk about several domain names, and one server. These are going to be:

www.domain1.com, www.domain1.net, www.domain1.org, essai.domain1.net
www.domain2.com, www.domain2.net, www.domain2.org, othersubdomain.domain2.net

We would like to have all the domain1 having the same content, all the domain2 but "othersubdomain.domain2.net" with the same content, and "othersubdomain.domain2.net" with a different content.

### Create a folder in the main folder.

> Name it "parameters"

### create, in the folder parameters a source: whoisit.inc.php

> Sources of parameters/whoisit.inc.php:

>     <?
>          $serverName = $_SERVER['SERVER_NAME'];

>          // The following line strips www from servername
>          // comment if not needed.
>          $serverName = str_replace("www.","",$serverName);

>          // These lines will cause all .org/.net/.com sites to be treated the same
>          // so postnuke.com and postnuke.net would point to the same multisite config
>          $serverName = str_replace(".org","",$serverName);
>          $serverName = str_replace(".net","",$serverName);
>          $serverName = str_replace(".com","",$serverName);

>          // optional default for no match on $SERVER_NAME
>          // uncomment to use
>          /*
>          if (!file_exists($serverName)) {
>              $serverName = "defaultsite";
>          }
>          */
>     ?>

>     You may find a "whoisit.inc.php" in the folder NS-Multisites/installation. Copy it in the folder "parameters".

### In that folder, create a folder with the name domain1, an other one with the name domain2, and a third one with the name "othersubdomain.domain2".

> In these folders, copy the original config.php, and modify each of them as you want, especially $dbname, or $prefix.

### Create a folder in each of these folders, name it "images"

> If you use a multi sites configuration, it is normal the logos are in these personal folder. The logo is a minimum. In that folder, put the image you want to use as a logo for that site. IT IS MANDATORY.

> I did modified the scrip print.php to go and get it there. The themes has to be modified accordingly, ie I did correct the theme "extralite", and that is all.

> The modification is:

> > img src=\"".WHERE_IS_PERSO."images/logo.gif\" alt=\""._WELCOMETO." $sit

> I dont really understand why this "logo.gif" appears here, it should obviously be "$site_logo" ...

### Replace original config.php in the root with:

> <?

> include("parameters/whoisit.inc.php");
> if (!(empty($serverName)))
> { include("parameters/".$serverName."/config.php"); }

> /* this next defined is coming before the one I put in mainfile2.php. So there are 2 possibilities, to destroy the one I put in mainfile2.php, or to let it, as it is coming after the one below, it wont affect WHERE_IS_PERSO. */

> define("WHERE_IS_PERSO","parameters/".$serverName."/");

> ?>

> You may find a config.php in "NS-Multisites/installation". Copy it in your root of postNuke, but please, dont forget to copy the original config.php as explained above, before you copy that one !

### With this, your site is multi site. Now, you may want give the possibility to your sub sites to have personnal (exclusive) themes.

> Explication: your site is "multi site". You can modifiy anything in each config.php, it will affect only the corresponding site. But: the themes are still the themes available in your top themes folder. The images topics are still the one in your top images/topics ... We are going to personalyze these also.

### In the folders "domain1", "domain2", "othersubdomain.domain2":

> Create a folder themes in each of them.

> In that folder, you have to create an empty "index.html", for security reasons. Then you may copy a complete theme, like the one you may find in the principal themes folder (with its sub folders, css ...). The themes you put there HAS TO HAVE A DIFFERENT NAME. For Instance, I did my tests with a copy of PostNuke theme, renaming it in PostNuke2. That is all, since now on, you should see that PostNuke2 theme in your change folder list, beside the themes present in the main folder.

### That is all for the personal themes.

### A personal pntables.php ?

> Easy ! just copy pntables.php into your "parametes/linux.mouzaia" folder. Then you can modify it. If the system does not find a pntables.php in that folder, it uses the master one.

### Personal Images.

Since config.php is not used so much in .71, but a table in the database, I presume it is possible to modify the content of ex-tipath directly in the database:

SELECT nuke_module_vars.pn_value FROM nuke_module_vars WHERE nuke_module_vars.pn_modname='/PNConfig' AND nuke_module_vars.pn_name='tipath'

Since tables belongs to a domain, you can modify pn_value, changing the path to the images there.

### It does not work !

In whoisit.inc.php, I just treat .com, .net, .org, but of course, you may have to treat .fr or .co.uk, or dont treat them at all, then use a folder named linux.mouzaia.org for instance, or whatever you want ....