Im having great trouble trying to make PDFs available for download via the SXA search component.

My existing PDFs are searchable and visible in the results, but the link is always prefixed relative the sitecore instance i.e. "/sitecore/login/-/media/project/"

Clicking on a PDF from the seach results in the following error: Error screen when clicking on a PDF search result

For context, we have 3 sites setup on a 10.2 instance. The site I am trying to configure is the original site, the other 2 came later.

I have researched virtualFolder /physicalFolder settings but most posts are 10 years old so I'm presuming relate to 'older' configuration?

I cant find any refs to virtual or physical folders in our solution or the webroot, and am unclear where I might set/patch this if this is the cause?

All help and guidance appreciated, I really cant understand why this simple requirement is evading me.

  • can you attach the implementation. Commented Dec 6, 2023 at 16:42
  • Hi @Rameshkumar apologies if I'm missing the point but this is purely SXA, there's not much code I can attach. We have a search component in a global header and a results component on a results page. I have added the relevant 'Associated Media' to the search settings, and now PDFs from the the media library are being shown in the search results. theses are being matched based on the aggregate field SXAcontent. The problem I'm having is that when you click a PDF from the search results, the link is wrong as per the screenshot.
    – Jez Cowley
    Commented Dec 7, 2023 at 10:06
  • ok, Once you click the pdf link from the search result. what is the URL displayed in the browser? can you share the URL Commented Dec 7, 2023 at 17:17
  • "/sitecore/login/-/media/project/myproject/mypdf.pdf", I would expect it to be "mysite/-/media/project/myproject/mypdf.pdf"
    – Jez Cowley
    Commented Dec 8, 2023 at 10:29
  • can you check this sitecore.stackexchange.com/questions/6046/… Commented Dec 8, 2023 at 15:29


Your Answer

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

Browse other questions tagged or ask your own question.