So here is the scenario
You are running the home page of a Sitecore website.
– The page runs perfectly from the CD servers
– The page runs perfectly from the “Experience editor” mode from the CM servers
– But when you run the page from “Preview” mode from CM servers, it give you above error
You are redirected to the no layout error page like this:
Well, now if you manually create this URL –
Now preview works, and this is a very annoying error.
There can be multitude of reasons for the error, as you don’t know if this is a publishing issue, or security issues as Preview mode used anonymous user to show the item and if the item does not has anonymous access enabled you might have got this error. We tried to fix the problem by targeting these probable causes. But nothing was working.
So after lot of toiling we figured out that this was the reason for the error –
In preview mode Sitecore looks for the item configured in preview database in CM server pointing to preview. But if that CM server is not configured then you will get this error.
On CM servers, if the Preview servers are not configured, then the database must be pointing to “Master” for preview proposes.
Go to Site settings of the website in Sitecore.config( location: WebsiteApp_ConfigInclude)
<site name=”website” enableTracking=”true” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/home” database=”master” 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”/>