Skip to main content
Add suggestion
Source Link
Hishaam Namooya
  • 9.7k
  • 1
  • 19
  • 37

The reason why you are receiving the SiteContext as micrositemain is because url.Host will return microsite.mysite.com.

Please see updated SiteDefinition below:

name="micrositemainone"
hostName="microsite.mysite.com" 
virtualFolder="/{language_here}/company1" //ex: /en/company1
startItem="/en/Home"
physicalFolder="/{language_here}/company1" 
rootPath="/sitecore/content/Site/Microsites/company1" 
SiteSettingsNode="/sitecore/content/Site/Microsites/company1/Site Settings"

name="micrositemain" 
hostName="microsite.mysite.com" 
virtualFolder="/"  
startItem="/Home"
physicalFolder="/" 
rootPath="/sitecore/content/Site/Microsite/Main"  
SiteSettingsNode="/sitecore/content/Site/Microsites/Main/Site Settings"

UPDATE

I have tested the above locally and saw that you need to update the setting Languages.AlwaysStripLanguage to false and add the above changes to the SiteDefinition.config.

Based on your question updates, I would suggest to manage it through the code, which is, option 2. The reason because you will have more control of it.

The reason why you are receiving the SiteContext as micrositemain is because url.Host will return microsite.mysite.com.

Please see updated SiteDefinition below:

name="micrositemainone"
hostName="microsite.mysite.com" 
virtualFolder="/{language_here}/company1" //ex: /en/company1
startItem="/en/Home"
physicalFolder="/{language_here}/company1" 
rootPath="/sitecore/content/Site/Microsites/company1" 
SiteSettingsNode="/sitecore/content/Site/Microsites/company1/Site Settings"

name="micrositemain" 
hostName="microsite.mysite.com" 
virtualFolder="/"  
startItem="/Home"
physicalFolder="/" 
rootPath="/sitecore/content/Site/Microsite/Main"  
SiteSettingsNode="/sitecore/content/Site/Microsites/Main/Site Settings"

The reason why you are receiving the SiteContext as micrositemain is because url.Host will return microsite.mysite.com.

Please see updated SiteDefinition below:

name="micrositemainone"
hostName="microsite.mysite.com" 
virtualFolder="/{language_here}/company1" //ex: /en/company1
startItem="/en/Home"
physicalFolder="/{language_here}/company1" 
rootPath="/sitecore/content/Site/Microsites/company1" 
SiteSettingsNode="/sitecore/content/Site/Microsites/company1/Site Settings"

name="micrositemain" 
hostName="microsite.mysite.com" 
virtualFolder="/"  
startItem="/Home"
physicalFolder="/" 
rootPath="/sitecore/content/Site/Microsite/Main"  
SiteSettingsNode="/sitecore/content/Site/Microsites/Main/Site Settings"

UPDATE

I have tested the above locally and saw that you need to update the setting Languages.AlwaysStripLanguage to false and add the above changes to the SiteDefinition.config.

Based on your question updates, I would suggest to manage it through the code, which is, option 2. The reason because you will have more control of it.

Source Link
Hishaam Namooya
  • 9.7k
  • 1
  • 19
  • 37

The reason why you are receiving the SiteContext as micrositemain is because url.Host will return microsite.mysite.com.

Please see updated SiteDefinition below:

name="micrositemainone"
hostName="microsite.mysite.com" 
virtualFolder="/{language_here}/company1" //ex: /en/company1
startItem="/en/Home"
physicalFolder="/{language_here}/company1" 
rootPath="/sitecore/content/Site/Microsites/company1" 
SiteSettingsNode="/sitecore/content/Site/Microsites/company1/Site Settings"

name="micrositemain" 
hostName="microsite.mysite.com" 
virtualFolder="/"  
startItem="/Home"
physicalFolder="/" 
rootPath="/sitecore/content/Site/Microsite/Main"  
SiteSettingsNode="/sitecore/content/Site/Microsites/Main/Site Settings"