0

I need to configure same host name for all my sites and load it based on Virtual folder path that will be language code. Refer below www.abc.com www.abc.com/en-be www.abc.com/fr-ca www.abc.com/es-es

Some sites are multilingual and some have 1 language only. How to set 1 host name with language code as Virtual path for all the sites.

3
  • Are you using SXA or Headless SXA? Commented Nov 28 at 13:34
  • no SXA or Headless SXA.
    – Udit
    Commented Nov 28 at 13:35
  • @udit Welcome to Sitecore Stack Exchange. Did you checked this https://sitecore.stackexchange.com/questions/358/what-is-the-usage-of-physicalfolder-and-virtualfolder-attributes-in-a-siteco.
    – ckhanna
    Commented Nov 28 at 13:36

2 Answers 2

0

we use a site that have support for multilanguage, also it have personalised sites for same language, like xxx.com/global (for en) ,xxx.com/de-de (or ja-jp or it-it) and have defined this site in config like this

 <site name="global" patch:before="site[@name='website']"
        notFoundItem="{4A25F950-06F7-427A-A160-F6AAA51FC64D}"
                  virtualFolder="/global"
                  physicalFolder="/"
                  rootPath="/sitecore/content/Global Site"
                  startItem="/Home"
                  database="master"
                  domain="extranet"
                  allowDebug="false"
                  cacheHtml="false"
                  htmlCacheSize="125mb"
                  enablePreview="true"
                  enableWebEdit="true"
                  enableDebugger="true"
                  enableAnalytics="false"
                  disableClientData="false"
                  enableItemLanguageFallback="false"
                  enableFieldLanguageFallback="false"
                  language="en" />


  <site name="global-de" patch:before="site[@name='global']"
  notFoundItem="{4A25F950-06F7-427A-A160-F6AAA51FC64D}"
            virtualFolder="/de-de"
            physicalFolder="/"
            rootPath="/sitecore/content/Global Site"
            startItem="/Home"
            database="master"
            domain="extranet"
            allowDebug="false"
            cacheHtml="false"
            htmlCacheSize="75mb"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            enableAnalytics="false"
            disableClientData="false"
            enableItemLanguageFallback="false"
            enableFieldLanguageFallback="false"
            language="de-DE" />

Here xxx/global is normal en site while xxx/de-de is language site, although there CMS path is same.

But for personalised site(Sites in en but having personalised data based on some cookie value) we handle it through code, hope it helps.

0

There are 2 things in the requirements to understand,

If you are trying to create a language-based site ie)

example:

  • /sitecore/content/TestSiteA
  • /sitecore/content/TestSiteB

Using any language code like (/en or /de-de etc) next to the domain name scsalik104cm.dev.local then a new site or page should be loaded based on the configuration defined in Sitecore.config's Sites node.

Considering this is not the Sitecore item language version based resolving for the domain requirement.

  1. If you are trying to have a language-based Sitecore item itself in the site but not a language version item, for example in the content tree if we have Sitecore item structure like /sitecore/content/SiteA/home/en or /sitecore/content/SiteB/home/de-de Then the en and de-de item will be loaded instead of the language version.

Examples of both scenarios: I have created 2 sites, in the first site TestSiteA I created the Sitecore item named "en" under the home page, so when I try to browse the page with domainname/en then the particular Sitecore's "en" item will be resolved.

Default Site domain without virtual directory as language code Site with item name as language code

Demo:

TestSite A Home Page Language Code based sitecore item

Another example I have created the second site TestSiteB and was able to resolve this site using the virtual directory with the site name "en", so whenever I try to browse the domainname/en then the home page from the TestSiteB will be resolved. Note The domain name will not get changed for TestSiteA and TestSiteB

Virtual directory based site TestSiteB Virtual directoty

Now we can both approach, now how to make this work in Sitecore, First, update the following setting if we not considering language version-based page resolving item. This below setting will ignore "en" or "de-de" as language code.

<setting name="Languages.AlwaysStripLanguage" value="false" />

once the above setting is done then update the sites node for resolving the site.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <sites>

 <site name="TestSiteB" patch:before="site[@name='website']"
            hostName="scsalik104cm.dev.local"
            virtualFolder="/en"
            physicalFolder="/"
            rootPath="/sitecore/content/TestSiteB"
            startItem="/home"
            database="master"
            domain="extranet"
            allowDebug="true"
            cacheHtml="true"
            htmlCacheSize="150MB"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            disableClientData="false"
            errorPage="/error"
 itemNotFoundUrl="/404"
/>
      <site name="TestSite" patch:after="site[@name='TestSiteB']"
            hostName="scsalik104cm.dev.local"
            virtualFolder="/"
            physicalFolder="/"
            rootPath="/sitecore/content/TestSiteA"
            startItem="/home"
            database="master"
            domain="extranet"
            allowDebug="true"
            cacheHtml="true"
            htmlCacheSize="150MB"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            disableClientData="false"
            errorPage="/error"
 itemNotFoundUrl="/404"
/>
    </sites>
  </sitecore>
</configuration>

I hope this helps you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.