The Issue
We have two sites, one domain, we want to setup a virtual directory on the domain which can access the second site.
IIS virtual directory doesn't seem to do the trick, sitecore does not seem to play nicely.
Is there a potential work around using sitecore?
The Environment
We have the following folder structure for two of our sites:
C:\Sitecore\Site1
C:\Sitecore\Site2
Site 1 and Site 2 both connect to the same web, core and master databases.
To access the cms for both sites in the browser we do:
- www.mysite1.com/sitecore
From Site 1's cms we create content, layouts and templates for Site 1 and Site 2.
The Solution
What we did is in the first sites web.config we defined the site as normal:
<site name="site1" hostName="mysite1.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/MyItem1/" 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" />
In the second sites web.config we defined the site slightly differently:
<site name="site2" hostName="mysite1.com" virtualFolder="/Site2" physicalFolder="/" rootPath="/sitecore/content" startItem="/MyItem2/" 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 second site we defined a virtual folder which you can notice above that was the only difference along with the obvious start item differences.
Site 1 will respond like normal. You can visit mysite1.com it will load the start item relevant for website 1.
When you visist mysite1.com/Site2/ it will load the virtual folder defined in the second site and load its relevant start item.
That is pretty much it works like a charm.
And finally @Mark Ursino thanks for your help.
To Note
You need have sitecore scalability configs enabled for any of the above to work
<site ...>
configuration from yourweb.config
- Mark Ursinomyitem
relates to/Partners/UK/
or/Partners/NZ/
... is one of those whatmyitem
is? - Mark Ursinowww.example.com/myitem-no2/
does it render that item? But when you call LinkManager.GetItemUrl(...) it renders aswww.example.com/sitecore/content/myitem/myitem-no2/
? I'm still not sure what the issue is fully. - Mark Ursino