I want to configure my instance of Sitecore to respond with different sites at different urls. How can I do this?
This is an addition to Kyles answer. While you can do the full site definition for each site, it quickly becomes cumbersome and really for most of the settings you have the same values.
So you can use property inheritance in the patch file. For example if we have 4 sites, we can create the first one with fill definitions, but for the others, we can just change the values that are different, like this:
<sites> <site name="site1" virtualFolder="/sitecore/admin" physicalFolder="/sitecore/admin" enableAnalytics="false" domain="sitecore" loginPage="/sitecore/admin/login.aspx"/> <site name="site2" inherits="site1" /> <site name="site3" inherits="site1" domain="extranet" /> <site name="site4" inherits="site1" enableAnalytics="true" /> <!-- etc etc ... --> </sites>
inherits attribute in the other site nodes. This makes it nice and simple to add new site definitions.
The rest is covered in the answer by Kyle.
You can configure Sitecore to respond to requests with different home nodes based on the url.
To do so, you need to perform the following steps:
- Configure DNS appropriately.
- Add a binding in IIS for each hostname.
- Copy or rename the config file
- Modify the config file from step 3 with a new
<Site>node for each site.
<!-- this entry will respond to http://site1.hostname.com/mysite with the /Sitecore/sites/mysite/home node --> <site name="SiteName" patch:before="site[@name='website']" hostName="Site1.hostname.com" virtualFolder="/mysite" physicalFolder="/" rootPath="/sitecore/sites/mysite" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"/>
This is one of those questions where there are multiple answers available. The answer above by Kyle Trauberman is the default, configuration way that Sitecore provides to do multiple sites. It has it's pro's and con's.
There are also a handful of modules on the Sitecore Marketplace, such as Dynamic Sites Manager, that provide the ability to create sites within Sitecore itself.
In addition, available as an extra module purchase to your Sitecore license, the Sitecore Experience Accelerator (SxA), provides built-in multi-tenant, multi-site capabilities within Sitecore, and not bound by configuration files.
As the other comments have mentioned the hostnames in the config need configuring however alongside that there are quite a lot of things to consider for multi-site in Sitecore and the difficulty of getting it to work depends on if it was considered in the initial build or not.
I'll jot down some bits and pieces to consider, especially in the scenario where this is not a greenfield build.
Have an area of the tree for true "Global settings" across all sites in Sitecore and a separate one for each of the specific global settings, for example site logo etc.
Do you need global components and site specific components? If so split component folders to global and site specific too
Relative data sources
Check to see if any data sources need to be changed to be relative to the site you're in, useful when referencing site specific global settings.
For SEO you need to consider a separate robots.txt and sitemap.xml for each site
There is a Sitemap XML module available on the Sitecore market place (https://marketplace.sitecore.net/Modules/Sitemap_XML.aspx), this will need to be assessed to ensure it works correctly in Sitecore 8
There is a Robots.txt module available on the Sitecore market place (https://sitecoreclimber.wordpress.com/2014/07/27/sitecore-multisite-robots-txt/), this will need to be assessed to ensure it works correctly with Sitecore 8
Ensure that Sitecore only searches over each individual site not all microsites - details on this are here (for SOLR)
404 and 500 pages
Do these need to be different for each site? In which case this will need to be handled; pretty sure we used a module off the marketplace for this but I can't remember which; I'll update this when I track it down.
Organise the media library so there are different areas for each site
Security and workflow
Add security and workflow to lock down roles to access the correct areas of the site
Web forms for marketers
We didn't need to do this as the micro-sites didn't require forms however details are here:
Configure the site node in IIS to add the new host name binding.
Create a patch file to patch in a site node to the
/sitecore/sites configuration section.
<?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <sites> <site name="site" patch:after="site[@name='modules_website']" targetHostName="site.hostname.com" database="master" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site" startItem="/Home" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" enableItemLanguageFallback="true" /> </sites> </sitecore> </configuration>
Change the values for targetHostName, rootPath and startItem to match for the site you are configuring.
Place the patch config in
Follow below steps :-
Create different folder items for each sites pages
Add/enable the SiteDefinition.config file and add site entry,
<site name="MyOnline" patch:before="site[@name='website']" hostname="mvcsitecoredemo" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/MyOnline" startItem="/index" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" language="en" />
Add separate binding in IIS for each host name
Add host entry in hosts file (if it is local site)
Please avoid common mistakes like - assigning attribute @name='website' for multiple sites while defining the patch but it should be different for each site otherwise second site will show first sites pages only.