I want to give URL mappings to DAM/Digital Assets of My sites. Especially for PDFs. Whenever I give a Download link to PDF it's Showing the full folder structure to the PDF. I want to shorten this. I am Using AEM 6.2 .
0
votes
I’ve done this before by means of exposing the asset UUID and handling the download via a servlet. So, on author side, the authors adds an asset, then in a sling model, get the UUID and render the servlet path and uuid as a param. Aforementioned servlet would find that asset via the UUID and serve it.
- Ahmed Musallam
2 Answers
3
votes
1
votes
You can define URL mappings under the /etc/map location. Take a look at https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html, which includes this example:

Under /etc/map you can create a folder, and then within that folder create a .content.xml file that contains properties such as these:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Mapping"
sling:internalRedirect="/content/dam/the/full/path/to/your/file.pdf"
sling:match=".+/content/short-url.pdf"/>