Changing root media url in v13
p
Is it possible to change the root path for the media directory? We have a collision and need to change the name of the root url segment from /media to /assets. Ideally we wouldn't change the physical folder name. I've implemented this MediaFileSystem but it has not had an effect:
Copy code
public void Compose(IUmbracoBuilder builder)
{
    builder.SetMediaFileSystem(factory =>
    {
        var webHostingEnvironment = factory.GetRequiredService<IWebHostEnvironment>();
        var hostingEnvironment = factory.GetRequiredService<IHostingEnvironment>();
        var ioHelper = factory.GetRequiredService<IIOHelper>();
        var logger = factory.GetRequiredService<ILogger<PhysicalFileSystem>>();

        // Define the folder location and URL
        var rootPath = webHostingEnvironment.MapPathWebRoot("~/media");
        var rootUrl = hostingEnvironment.ToAbsolute("~/assets"); // Use /assets instead of /media

        return new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, rootPath, rootUrl);
    });
}
FWIW, I also tried changing
UmbracoMediaPath
in appsettings and that also does not appear to be applying the expected result.
16 Views