I don't think there's a setting to do it out-of-the-box, but you could implement it yourself. The media paths are created by an implementation of the IMediaPathScheme interface. By default, Umbraco 8 uses UniqueMediaPathScheme, but it also includes OriginalMediaPathScheme which generates the old numeric folder names.
You could enable the original scheme with a UserComposer like
public class MyComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.RegisterUnique<IMediaPathScheme, OriginalMediaPathScheme>();
}
}
However, that would use numeric paths for all new media items as well as preserving existing paths. If you want to use GUID-based paths for new media items, you could register your own custom implementation of IMediaPathScheme, combining OriginalMediaPathScheme's check of the previous URL with UniqueMediaPathScheme's approach to creating new paths.
Thank you Steve! Your recommendation on how to switch to old paths worked.
I tried figuring out how to implement IMediaPathScheme so it handles both, would you know where and how I would start? I know how to do it on version 7 but am a bit lost with 8 :(
Had the same issue. Turns out v8 will preserve the media/x/ path if you:
click the "Remove file(s)" link below your document and then upload the updated document (using the same file name).
Note: if you are working in multiple environments, you'll need to completely delete the file from the Live environment before you queue the updated document for transfer. You may encounter errors otherwise. At least, I have.
Keeping old /media/ links when replacing a file on Umbraco 8
Hi everyone,
Is there a setting or a method to keep the old /media/1234/ links on Umbraco 8 when replacing a PDF for example?
We have old links people reference to and would be great to keep them.
Thank you! Genc
I don't think there's a setting to do it out-of-the-box, but you could implement it yourself. The media paths are created by an implementation of the
IMediaPathScheme
interface. By default, Umbraco 8 uses UniqueMediaPathScheme, but it also includes OriginalMediaPathScheme which generates the old numeric folder names.You could enable the original scheme with a UserComposer like
However, that would use numeric paths for all new media items as well as preserving existing paths. If you want to use GUID-based paths for new media items, you could register your own custom implementation of
IMediaPathScheme
, combiningOriginalMediaPathScheme
's check of the previous URL withUniqueMediaPathScheme
's approach to creating new paths.Thank you so much Steve! I will give this a try and let you know how it works, also share how I've done it.
Thank you Steve! Your recommendation on how to switch to old paths worked.
I tried figuring out how to implement IMediaPathScheme so it handles both, would you know where and how I would start? I know how to do it on version 7 but am a bit lost with 8 :(
Thank you! Genc
Hi there!
Had the same issue. Turns out v8 will preserve the media/x/ path if you:
click the "Remove file(s)" link below your document and then upload the updated document (using the same file name).
Note: if you are working in multiple environments, you'll need to completely delete the file from the Live environment before you queue the updated document for transfer. You may encounter errors otherwise. At least, I have.
Hope this helps! Cheers, Mia
is working on a reply...