---
title: File providers and virtual paths
slug: cms-13/docs/file-providers-and-vitual-paths
docTags: 
createdAt: 2026-07-30T20:22:07.530Z
---

File providers let you map physical files to virtual paths, so you can store resources in a single location and serve them under any configurable path on your site. Optimizely CMS registers a composite file provider that supports custom provider registration for shell modules and other resources. For background on ASP.NET Core [file providers](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-5.0), see the Microsoft documentation.

## Composite file provider

ASP.NET Core provides two file providers, `ContentRootFileProvider` and `WebRootFileProvider`, available on [`IWebHostEnvironment`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.iwebhostenvironment?view=aspnetcore-5.0). Optimizely Content Management System (CMS) also registers an `ICompositeFileProvider` instance that wraps the built-in providers and supports additional provider registration.

Register custom file providers through `CompositeFileProviderOptions`. The composite file provider resolves resources from shell modules. CMS registers the composite file provider in the dependency injection (DI) container.

## Mapping physical file provider

Use `MappingPhysicalFileProvider` to map physical files from locations outside the application root. The following example registers a `MappingPhysicalFileProvider`:

```csharp
serviceCollection.Configure<CompositeFileProviderOptions>(c => {
    c.BasePathFileProviders.Add(new MappingPhysicalFileProvider("/SomeVirtualPath", string.Empty,
      Path.Combine(webHostEnvironment.ContentRootPath, @"SomePhysicalFolder")));                  
  });
```

## Zip archive file provider

`ZipArchiveFileProvider` serves files stored in a zip archive. When you register a shell module, CMS automatically registers a file provider for it. If the resources are packaged in a zip archive, CMS registers a `ZipArchiveFileProvider` instance.
