Tuesday, November 30, 2010

Page Editor not working with Multiple Sites Configured


For those configuring multiple sites in one Sitecore instance. Here is a tip to save you hours of pain. Make sure your websites are listed below the out-of-box Sitecore site entries not above.

If you reverse the order then the page editor will throw an error complaining that Sitecore.UiUtil.GetHomeItem() cannot find the object when logging into sitecore from your domain. Eg. www.test.com/sitecore/login will not work properly but localhost/sitecore/login works.

Turns out the handler checks the entries starting at the top and stops at the first match.

This order works:



<site name="login" virtualfolder="/sitecore/login">
<site name="testing" virtualfolder="/sitecore/testing">
<site name="admin" virtualfolder="/sitecore/admin">
<site name="service" virtualfolder="/sitecore/service">
<site name="modules_shell" virtualfolder="/sitecore modules/shell">
<site name="modules_website" virtualfolder="/sitecore modules/web">
<site name="site1" hostname="sitecore.site1.com" virtualfolder="/">
<site name="site2" hostname="sitecore.site2.com" virtualfolder="/">

This order fails:

<site name="site1" hostname="sitecore.site1.com" virtualfolder="/" br=""><site name="mica" hostname="sitecore.site2.com" virtualfolder="/" br=""><site name="shell" virtualfolder="/sitecore/shell" br=""><site name="login" virtualfolder="/sitecore/login" br=""><site name="admin" virtualfolder="/sitecore/admin" br=""><site name="service" virtualfolder="/sitecore/service" br=""><site name="modules_shell" virtualfolder="/sitecore modules/shell" br=""><site name="modules_website" virtualfolder="/sitecore modules/web" br="">

Hope this saves you some time and/or frustrations. If you have any tips, tricks or resources you would like to share with the guild please email them to sitecoreguild@outlook.com


2 comments:

  1. Hey Susan, thanks for this post. It was driving me crazy!.

    ReplyDelete
  2. Thank you for this. Mine surfaced as a TargetInvocationException on WebEditRibbon, which was very misleading, but was the same error as described.

    ReplyDelete