1

we are using Sitecore 9.0.2, sitecore sxa 1.7.1

enter image description here

In Content Delivery site, we are showing full image path like:

/-/media/Project/MyTest/MyTenant/mytestsite/TestImage.jpg?h=168&la=en&w=300&hash=FFB1492C0D4A2198E64AD69B5EC73AA1)

User can easily identity the image path(please refer the above image).
Is there any option to avoid to show full (image/pdf) path OR is it possible to short item path or any other way to solve this issue

Example : Image, pdf file

1 Answer 1

4

You can use Media.UseItemPaths setting and set it to false:

<setting name="Media.UseItemPaths" value="false" />

Then your media links will use short ID of media items instead of the full path like :

<img src="/-/media/8FA551CAE3544FEDBAD801FB826033C9.png" />

But why would you want to do this? What is wrong with url like

<img src="/-/media/Project/MyTest/MyTenant/mytestsite/TestImage.jpg?h=168&la=en&w=300&hash=FFB1492C0D4A2198E64AD69B5EC73AA1" />

The full media path is needed for Sitecore to determine which media item should be returned for given link. You either need that or ID of the item, there is no other way.

3
  • Is there any options to show short URL in images(only for images)
    – PKH
    Jun 2, 2019 at 4:39
  • @PKH This issue is raised by Qualys scan in our project. Is it a real security issue if path is shown in media files? If I use above suggested answer, then the fonts, images etc which are referenced by name from the css files, throw 404 not found error. Will need to make change there as well.
    – NewbieHere
    Nov 12, 2021 at 11:14
  • That's not a security issue. It doesn't matter what the path is in media library. Nov 12, 2021 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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