Consider this scenario: a user has two images in a Sitecore media folder with the same name. They go into a content item (page) and into a rich text field to fill out the body of the page. They click Insert Sitecore Media and select one of the two images (let's call it Media Item A). They save, the HTML is updated and is referencing the media hash / ID of Media Item A. They publish Media Item A and the content item. On the site, they browse to the page and see Media Item B.

This is an issue that was just brought to my attention. I thought it was strange that they had two images with the same name, so I renamed Media Item B to something else and published to web. Sure enough, this fixed the issue - Media Item A is now appearing on the front end.

My question: if Sitecore is directly referencing Media Item A in the rich text field, why is Media Item B being displayed?

1 Answer 1


When the Media.UseItemPaths Sitecore setting is set to true (the default), Sitecore uses the media item's path for a URL.

For instance, if you have a PNG file at /sitecore/media library/Images/logo, with stock configuration this would generate a path similar to this: /~/media/Images/logo.png. As you can see, if two images in the same folder have the same name (regardless of extension), you will get a conflict and Sitecore will simply take the first one that it finds.

If you change this setting to false, the generated URL will look more like this: /~/media/6792A746C35A45D5B4C33DE9C76F105C.png. This prevents any naming conflict, at the cost exposing your item's IDs and having media items with irrelevant names. Personally I would avoid this.

You'll find more details, as well as a workaround for the case of two files with different extensions, in this blog post by Martin Davies: http://sitecoreskills.blogspot.ca/2014/01/handling-duplicate-media-paths-in.html

  • 1
    I verified the setting is set to true, so this definitely makes sense. Thank you!
    – Paul
    Mar 31, 2017 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.