title: Serving multiple sites from the same wwwwroot
body: <p>I have an ASP.NET Core 5 MVC application which serves multiple sites using the <a href="https://github.com/ligershark/WebOptimizer" rel="nofollow noreferrer">ASP.NET Core Web Optimizer</a>; e.g.,</p>
  <pre><code>https://example.com 
  https://example.com/store1
  https://example.com/store2
  </code></pre>
  <p>All sites have same <code>wwwwroot</code> directory.</p>
  <p>I tried code below to provide a single <code>wwwwroot</code> in my <code>startup.cs</code> and it worked. However, Guru wrote that every middleware should be called only once.</p>
  <p>How do I serve multiple sites using the same <code>wwwroot</code> directory?</p>
  <p>In my <code>startup.cs</code>:</p>
  <pre><code>    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {  
          app.UseWebOptimizer();
          app.UseWebOptimizer(env, new FileProviderOptions[] { new FileProviderOptions()
                  {
                      RequestPath = new PathString(&quot;/store1&quot;),
                      FileProvider = env.WebRootFileProvider
                  }
                  });
          app.UseWebOptimizer(env, new FileProviderOptions[] { new FileProviderOptions()
                  {
                      RequestPath = new PathString(&quot;/store2&quot;),
                      FileProvider = env.WebRootFileProvider
                  }
                  });
          app.UseStaticFiles();
          app.UseStaticFiles(new StaticFileOptions
          {
              RequestPath = new PathString(&quot;/store1&quot;)
          });
          app.UseStaticFiles(new StaticFileOptions
          {
              RequestPath = new PathString(&quot;/store2&quot;)
          });
      }
  </code></pre>