Hosting multiple sites based on Folder names in mojoPortal content management system requires that the master site run as a root Web site, that is, it must have an url structure like:
The child sites will be based on the first folder name after the host name segment like:
Note that if IIS or Apache is configured so that all requests are handled by ASP.NET then the Default.aspx is not needed. A default configuration of IIS does not pass all requests to ASP.NET, instead, only certain files are handled by ASP.NET, like .aspx files. This is because it is more efficient to let IIS handle requests for image files and html pages directly. The web server built into Visual Studio handles all requests using ASP.NET so you might expect it to behave the same way when deployed to IIS but that is not the case.
In a default configuration of IIS, a request like http://hostname/site2/ will be handled first by IIS, typically it will look for a Default.aspx file in the folder named somefolder and if it is found it will hand the request off to ASP.NET but if the folder does not exist and/or the file is not there, it will generate a 404 page not found error rather than handing the request to ASP.NET.
So if you want to have it work with urls like http://hostname/site2/ you would need to either make ASP.NET the default handler for all requests or make sure the folder exists and it contains a file named Default.aspx. The Default.aspx file can be just an empty text file, it doesn't need any code or contents in it, its only purpose is to get ASP.NET to handle the request. From there the mojoPortal code detects the folder mapped to the site and serves the correct content. Without doing one of these things, the only way ASP.NET will handle the request is if the url ends with Default.aspx or somepage.aspx where somepage.aspx is an url defined by the site.
How To Create Folder Based Sites
Get the first site working first
Make sure the web.config setting AllowMultipleSites is set to true.
In Web.config, set UseFoldersInsteadOfHostnamesForMultipleSites="true"
Go to Administration > Site List in the first site.
Click the "Create New Site" link.
Enter the Site Title and any other settings you want on the new site and then click the "Save" button at the bottom of the page.
After you save the new site, some new tabs appear on the settings page for the site, "Folder Site Mapping," "Features" and "WebParts." Click the "Folder Site Mapping" tab.
Type the name of the folder that will map to the new site and click the "Add Folder Mapping" button.
Note that I have mapped a folder named "site2" to the second site. So if my master site is at http://localhost/, I can now open a browser and go to http://localhost/site2/Default.aspx to see the second site.
Folder names can have only alphanumeric characters and cannot have spaces. Folder names that conflict with existing mojoPortal system folders cannot be used. If you need to block additional folder names from being used you can append them to the ones listed in Web.config DisallowedVirtualFolderNames setting using semi colons to separate the folder names to block.
If you want the urls to work without the Default.aspx page (i.e. http://somehost/site2) you should also create a physical folder beneath the root site with the same name (ie. "site2" as shown above) and put an empty text file in there named Default.aspx. Otherwise you would need to look into configuring IIS or apache so that all requests are handled by ASP.NET.
Click the "Features" tab and add the features you want available to the site.
An important thing to understand when using folder based child sites is that since all the sites share the same host name, they also share the same physical cookie file and the same authentication ticket. In mojoPortal CMS code we mitigate this as much as possible by using site specific cookie names to help keep most of the cookies separate. Since the authentication cookie is shared, if you login to one site it logs you out of any other site running in the same installation if your login name is different. This is because your login name is stored in the authentication ticket which is shared across folder based sub sites. If your login name is the same across sites it will not log you out of the other sites but you will have to login to each site separately. That is, logging into one site doesn't log you into all sites.
The above issue only pertains to folder based sub sites. Sub sites based on host names have different physical cookie files and therefore have no interaction.