iisweb-configsitecoresitecore7.5

How to setup Multiple sites (Multi domain sites) in one Sitecore instance in My Local Machine?


I have been trying to configure multiple sites with multiple domain in my local instance.

Sitecore Content tree

Sitecore
   -> Content
      -> Home
      -> PublicHome

I have the following web.config settings.

<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"/>

<site name="PublicHome" hostName="my.public.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/PublicHome" language="en" database="web" domain="extranet" />

I have created couple of Host file entry.

127.0.0.1 My.Sitecore.com

127.0.0.1 my.public.com

My.Sitecore.com - Loading the Home Page.

But my.public.com is not loading as expected.

When binding was not setup in the IIS site. I was getting IIS Default site.

Once I add the binding on the IIS site. I was getting "Home" instead of "PublicHome".

Version info: Sitecore 7.5, IIS in Windows 10


Solution

  • To fix your immediate issue, add your custom site definition before the default "website" entry.

    To better prepare yourself for future upgrades, utilize Sitecore patch attributes and a separate configuration file to apply your custom site definition. (i.e. <site name="PublicHome" patch:before="site[@name='website']">). Read about web.config patching to learn more.