This section describes the process of configuring an extra site in the web.config file.
The Sitecore installation has only one published web site configured by default. It corresponds to the <site name=“website”…/> definition in the web.config file.
The “website” section of the clean Sitecore installation is shown below:
Sitecore determines the site context based on the incoming URL and the following two attributes:
In other words, the hostName and virtualFolder attributes define a unique site in Sitecore.
hostName should also be defined in the hosts file.
Sitecore determines the site the following way:
For each site in the <sites> list
Sitecore compares the hostName attribute (which may include wildcards) with the incoming URL
- If the hostName attribute matches the incoming URL or the hostName attribute is empty, Sitecore compares the virtualFolder attribute.
- If these two parameters match the incoming URL , the site is used as a context site.
Note that Sitecore checks for sites in the order in which they are included in the list. Thus, the "website" site should most likely be one of the last entries in the list, because it is the most general entry and matches all URLs in the site.
A unique site may also be defined in Sitecore by using the sc_site string parameter. If this parameter is present in the incoming URL, its value is interpreted as the name of the requested site. The system searches for a site with such name among those declared in the web.config file. If the appropriate site is not found, the error occurs. If the sc_site query string parameter is not set, SiteResolver searches for the requested site using hostName and virtualFolder attributes.
Below is the list of the most often used <site> attributes. Each of them is described in detail in the <site> attribute properties section.
The examples section illustrates the above concepts.
Note : the required attribute set depends on the purpose of the site. For instance, the publisher site requires only three attributes: name, domain and enableWorkflow, while the site which is displayed on the front-end requires all the attributes listed above.