﻿![]()

#### 

This article is about an issue that we faced during building a multisite JSS Sitecore architecture. Some of our sites use the same domain with different virtual folders. I was surprised that the Layout Service can not resolve a virtual directory by default. Sitecore recommends to always populate sc\_site parameter in the calls to Layout Service to use this technique. But, if you have more than one JSS app, you have to add additional code to extend the Layout Service call with the query string parameter.

I prefer another way. I extended the Sitecore SiteResolver:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/article-virtual-dir-sample1.png?h=782&amp;w=647&amp;hash=079770EDC1BAC918CBEA994B5FFDCCAC)

Here is an image to clarify what has changed:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/capture.png?h=336&amp;w=799&amp;hash=8441148C9419FBA79328E1441A565CB9)

Then we need to patch the configuration to override the default Sitecore Site Resolver:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/article-virtual-dir-sample2.png?h=184&amp;w=652&amp;hash=B6834ED4E303BA2F22AFEE9E48256FD0)

Take into account that the previously known RisolveSite processor is not used anymore:

![](https://www.brimit.com/-/media/project/brimit/blog/2020/capture2.png?h=200&amp;w=802&amp;hash=45B3413C43710E2AC894BF533F830E67)

![](https://www.brimit.com/-/media/project/brimit/blog/2020/article-virtual-dir-sample3.png?h=86&amp;w=662&amp;hash=2C572726E3CCAA0BC11389647DD3C751)

To sum up, this solution relieves the necessity to think about resolving virtual directory for each JSS app and have this fixed once for the whole installation.

###### More from author

[##### Deploy custom headless Sitecore solution in Sitecore XM Cloud
November 10, 2022](https://www.brimit.com/blog/deploy-custom-headless-sitecore-solution-in-sitecore-xm-cloud)[##### Running custom next.js editing host in Sitecore XM Cloud
September 29, 2022](https://www.brimit.com/blog/running-custom-next-js-editing-host-in-sitecore-xm-cloud)[##### Running node.js based rendering host in Sitecore Managed Cloud
August 3, 2022](https://www.brimit.com/blog/running-node-js-based-rendering-host-in-sitecore-managed-cloud)

###### Author

[!\[artsiom-photo\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/artsiom-200.jpg?h=202&amp;iar=0&amp;w=200&amp;hash=41797D2540DF6EB6FDF558360F6F62B8)
Artsem Prashkovich
Sitecore MVP/ Solution Architect](https://www.brimit.com/blog/author?authors=Artsem%20Prashkovich)

###### More by category

[#Events](https://www.brimit.com/blog?categories=#Events)[#How-to](https://www.brimit.com/blog?categories=#How-to)[#News](https://www.brimit.com/blog?categories=#News)[#Guides](https://www.brimit.com/blog?categories=#Guides)

###### More by platform

[DXP](https://www.brimit.com/blog?platforms=DXP)[Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)[Application innovation](https://www.brimit.com/blog?platforms=Application%20innovation)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=79518ea5-9198-41c2-95ac-1b26271ae29c&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=How%20to%20resolve%20a%20virtual%20directory%20on%20a%20JSS%20Sitecore%20website&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fhow-to-resolve-a-virtual-directory-on-a-jss-sitecore-website&amp;r=&amp;lt=294&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=657934)