customizing url mapping of multiple sites in sitec

2019-08-10 01:35发布

问题:

So, I want to customize my mappings of urls to home pages inside Sitecore

my sites home pages are nodes like this (below /sitecore/content):

/FOO/us
/FOO/ca
/FOO/..other countries
/BAR

i Want to reach them by the following urls:

mysite.com/us -> /FOO/us
mysite.com/ca -> /FOO/ca
mysite.com/bar -> /BAR

my sites declarations are like this

<site name="FOO-US" virtualFolder="/us" physicalFolder="/us" rootPath="/sitecore/content" startItem="/FOO/us" 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="FOO-CA" virtualFolder="/ca" physicalFolder="/ca" rootPath="/sitecore/content" startItem="/FOO/ca" 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="BAR" virtualFolder="/bar" physicalFolder="/bar" rootPath="/sitecore/content" startItem="/bar" 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" />

However, i never get the expected url resolution, mostly i get 404 or get to the default Home node.

i'm testing this multi-site configuration in sitecore (6.5) in my local IIS (both 6.0 and 7.0 versions with no luck). Is that possible?

回答1:

You can't get this to work out of the box because they're all on the same hostname (mysite.com). You can get it to work if you set the startItem to FOO and put bar underneath it. Then all three separate "sites" would be immediate children of the root (FOO). E.g.

/Foo/us
/Foo/ca
/Foo/bar


回答2:

Did you remove the default 'website' definition? (you probably should). You may be able to do this by juggling the root and startItem paths, perhaps :

rootPath="/sitecore/content/FOO" startItem="/us"
rootPath="/sitecore/content/FOO" startItem="/ca"
rootPath="/sitecore/content" startItem="/bar"

or maybe (untested) :

rootPath="/sitecore/content/FOO/us" startItem=""
rootPath="/sitecore/content/FOO/ca" startItem=""
rootPath="/sitecore/content" startItem="/bar"

If these are just vanity urls rather than seperate sites, then leave the config as one site and use redirects (use one of the redirect modules) instead.