janeiro 20, 2016
When working with Preview mode in Sitecore 8.1, we noticed that the site wasn't behaving the way we had expected. Upon further investigation, we noticed that Sitecore was resolving the wrong site definition. It was loading the website definition rather than our custom definition.
After reviewing our custom definition to ensure everything was properly configured, our attention turned to the preview URL. This is when we noticed a parameter we hadn't seen before: sc_site=website. Quite obviously, this was the source of our issue. After a quick Sitecore 8.0 review, we confirmed that this did not appear in that build so it was new behaviour in Sitecore 8.1.
A quick search turned up this Sitecore KB article: https://kb.sitecore.net/articles/382913. It would seem that the patch referenced in this article has been incorporated into the Sitecore 8.1 product. Searching the 8.1 configuration files, we found this setting in /App_Config/Sitecore.config:
As expected, changing this value to true did indeed fix our issue. The sc_site parameter was now populated with the name of the custom site definition, rather than website. This approach seems the most flexible one, especially if you are purposely defining custom sites and URLs to your content author instance.
As noted in the XML comment above the setting, if you want to force the preview site to load a custom site definition other than website, leave the default value for Preview.ResolveSite and add the name of your custom site definition to this setting: