2
votes

I want to be able to reach my Sitecore website from two different Hostnames, and to do so I created a new entry under <sites> in web.config; here are the code snippets (I omitted the non relevant parts):

<site name="Site1" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="mysyte.dev" />
<site name="Site2" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="mysyte.mydev" />

I have saved the config and republished the whole website just to be sure, but to no avail: if I access the second site, I get the "The layout for the requested document was not found." error, apparently generated from requesting layout {00000000-0000-0000-0000-000000000000}.

IIS is configured properly, with both hostnames mapped to the same port in the relevant website - yet only one of them works.

Am I missing something really obvious here?

EDIT: the full site entries are as follows:

<site name="Site1" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="mysyte.dev" startItem="/AppName" loginPage="/login" database="master" 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="Site2" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="mysyte.mydev" startItem="/AppName" loginPage="/login" database="master" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"/>
4

4 Answers

6
votes

Yes. StartItem is missing. But for what you want, separate multiple hostnames in the same attribute by using the pipe delimiter, instead of two separate site definitions.

0
votes

What is most likely happening here is that the SiteResolver pipeline process is not actually hitting the site definition you think it should. That's the first place I would look. Make sure you have a default catch-all site defined (no hostName) and drop a basic rendering there so you can easily identify it. That being said, Mark's answer is the way to go.

Edit: Remember also that order of site definitions matters here.

0
votes

Try with this:

<site name="Site1" hostName="Site1.dev" virtualFolder="/" physicalFolder="/"  rootPath="/sitecore/content/Site1" startItem="/home" loginPage="/login" database="master" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enableAnalytics="true" enablePreview="false" enableWebEdit="false" enableDebugger="false" disableClientData="false" />
<site name="Site2" hostName="Site2.dev" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/Site1" startItem="/home" loginPage="/login" database="master" domain="extranet" allowDebug="true" cacheHtml="false" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="false" enableWebEdit="false" enableDebugger="false" disableClientData="false" />` 
0
votes

Set the targetHostName attribute on the 'site' node and set Rendering.SiteResolving to true.

<site name="Site1" hostName="mysyte.dev" targetHostName="mysyte.dev" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/AppName" loginPage="/login" database="master" 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="Site2" hostName="mysyte.mydev" targetHostName="mysyte.mydev" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/AppName" loginPage="/login" database="master" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false"/>