Cross-site linking in Sitecore

In a Sitecore instance that contains multiple sites, you may have found that links between different sites can result in incorrect URLs.
For example, suppose we have the following Sitecore structure:

  • Sitecore
    • Site A (
      • Page A
    • Site B (
      • Page B

Typically, a link from anywhere on Site A to Page B might result in a URL like “”, rather than the expected “”.

There are a number of things you need to get right in order for this to work properly:

  • The SiteResolving┬áproperty needs to be set to true on the UrlOptions when calling LinkProvider.GetItemUrl().
    There is a bug in that the Sitecore config setting (Rendering.SiteResolving) is never used to set this property automatically. This can be easily fixed by extending the LinkProvider with a few lines of code.
  • Site definitions must have┬áboth hostName and targetHostName attributes set in order for site resolving to work (even if the sites in question all use the same hostnames)

If you want language to be preserved correctly across cross-site links then also:

  • The Rendering.SiteResolvingMatchCurrentLanguage setting must be set to true
  • The casing of the language names must be the same between the definitions in the Sitecore tree and the language attributes on the site site definitions, as a case-sensitive match is performed.

Some relevant articles:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">