In the following example, you will learn how to set up two nested web sites. It should be possible to achieve any level of nesting in case that the following steps are complied with.
1. Install two projects into two independent, not overlapping folders. Choose folder names that won't be the same as the names in the URL to prevent later colision when seting up the IIS. The installation folders may be for example like this:
• | Inetpub/wwwroot/NestedWeb/Web1 (first web site from Web installer) |
• | Inetpub/wwwroot/NestedWeb/Web2 (second web site from Web installer) |
This means that you have two completely independent projects, as you can see in the screenshot below:
2. Open IIS management console and create two virtual directories:
• | [Default web site]/KenticoCMS1 (pointing to physical directory Web1) |
• | [Default web site]/KenticoCMS1/KenticoCMS2 (child directory pointing to physical directory Web2) |
Like this, you have two independent projects configured as nested only in the IIS.
3. The web sites are now accessible via nested URLs as you can see in the screenshot below. The web sites can be configured independently without experiencing any issues.
Additional configuration for Content staging
You may come to the point where you want to set up Content staging from one of these sites to another. Content staging has some sections in the web.config that collide. Config files are inherited within the IIS virtual directories structure (even when the projects are not nested on the file system), but you cannot have the same section of web.config twice in the config file.
So if we configure staging from the KenticoCMS1 site to the KenticoCMS1/KenticoCMS2 site (see details on how to configure the staging here), the inner project may have issues with the configuration. You would get an error like this:
The imporant part of the error message is "The username token has already been added", that means that some of the configuration is duplicate.
User name token authentication is defined in the policy file which is referenced from the <microsoft.web.services3> section, so remove the whole <microsoft.web.services3> section from the web.config of the inner project (Web2). Do not remove it from the Web1 (outer) project since this configuration will be used for both web sites. After doing this, Content staging should work flawlessly between the sites.
Page url: http://devnet.kentico.com/docs/devguide/index.html?configuring_nested_web_sites.htm