2
votes

I'm using a Sitecore install with multiple sites. When linking from example1.com (/sitecore/content/example1) to an item under example2.com (/sitecore/content/example2/about)

Sitecore is not generating the link correctly for any cross-domain links. It is generating: http://www.example1.com/example2/about.aspx This is what is expected: http://www.example2.com/about.aspx

The same thing happens from example2.com when linking to example1.com or any item under that site.

  • Both sites are defined in the web.config.

  • The rootNodes are both "/sitecore/content"

  • The start items are "/example1" and "/example2" respectively.

  • Rendering.SiteResolving is set to true

  • Rendering.SiteResolvingMatchCurrentSite is set to false

  • I'm using sc:link to generate the links.

  • Sitecore.Links.LinkProvider's alwaysIncludeServerUrl is set to true

2

2 Answers

4
votes

If you are using hostName with wild cards (eg. "www.example1.com|example1.com"), you need to set targetHostName="www.example1.com" on your entry.

Even if you only have one domain, set targetHostName, as there is one thing/function that only looks at targetHostName. Eg. GetItemUrl() doesn't work as planned without a targetHostName and in 6.5.0 ver. 120706 it doesn't account for stuff set in the web.config. This is a bug and one they hopefully have fixed in future version. If you expirience the problem look here for a solution: http://sitecorepm.wordpress.com/2010/08/04/using-cross-site-links-dynamic-links/

2
votes

Have you set the hostName value of the <site> entry in web.config?

<site name="example1" hostName="www.example1.com" ... />
<site name="example2" hostName="www.example2.com" ... />

There's a very good blog post on this here: http://blog.paulgeorge.co.uk/2011/05/01/sitecore-linkmanager-inside-out-muti-site-and-sub-site-setups/ It looks like you've covered everything else required to make this work.