Sitecore 多个站点和链接解析
我安装了 Sitecore 6.2,有 2 个站点,配置如下:
<site name="eu-website" hostName="dev.mysite.eu" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/Europe" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="us-website" hostName="dev.mysite.us" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/USA" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
这些站点按预期响应 URL,即:
http://dev.mysite.eu/About
->解析为:/sitecore/content/Europe/About
但是,我在使用 LinkManager 时遇到了问题。它生成了不正确的 URL,例如:
http://dev.mysite.eu/Europe/About
如您所见,它包含站点名称,该名称不正确并导致 404
。像这样使用 LinkManager:
var urlOptions = new UrlOptions();
urlOptions.SiteResolving = true;
string url = LinkManager.GetItemUrl(item, urlOptions);
有人知道我哪里出错了吗?
谢谢。
I have a Sitecore 6.2 installation with 2 sites, configured like so:
<site name="eu-website" hostName="dev.mysite.eu" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/Europe" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="us-website" hostName="dev.mysite.us" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/USA" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
The sites are responding to the URLs as expected, i.e:
http://dev.mysite.eu/About
-> Resolves to: /sitecore/content/Europe/About
However, I'm having trouble with the LinkManager. It's generating incorrect URLs, such as:
http://dev.mysite.eu/Europe/About
As you can see, it's including the name of the site, which is incorrect and causes a 404.
I'm using LinkManager like so:
var urlOptions = new UrlOptions();
urlOptions.SiteResolving = true;
string url = LinkManager.GetItemUrl(item, urlOptions);
Anyone know where I'm going wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能无法修复它,但尝试将保存该站点的节点拉出到
startItem
中:更改:
到:
This might not fix it but try to pull out the node that holds the site into the
startItem
:Change:
To: