Add internal link in multisite project

500 Views Asked by At

We have a project with 2 sites set up via Bindings in IIS.

All works well apart from when a content editor adds an internal link. Sitecore stores a value in the field such as

/OSS/Home/Assets/Freshwater wildlife

But the link doesn't resolve (404) until we remove the site name and Home to get a path

/Assets/Freshwater wildlife

I think the full path, /OSS/Home/Assets/Freshwater wildlife, is correct but how do we get Sitecore (6.5) to recognize this URL?

1

There are 1 best solutions below

0
On

first of all, you need to ensure your solution use correct hostnames when you rendering that links.

Please check your site configuration :

<site name="website_1" hostName="www.site1.com" language="en" cacheHtml="false" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site1" startItem="/home" database="web" domain="extranet" allowDebug="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website_2" hostName="www.site2.com" language="en" cacheHtml="false" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site2" startItem="/home" database="web" domain="extranet" allowDebug="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />

if it's something like this. Also please check if Rendering.SiteResolving is true on web.config.

<setting name="Rendering.SiteResolving" value="true" />

How you render your links on code ?

If you render with :

Sitecore.Links.UrlOptions defaultOptions = Sitecore.Links.UrlOptions.DefaultOptions;
string itemUrl = Sitecore.Links.LinkManager.GetItemUrl(item, defaultOptions);

please add:

defaultOptions.SiteResolving = true;