Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Hide content path for assets

Avatar

Level 2

In AEM Dispatcher, I want to hide the complete asset path from appearing in the browser when a user hovers over an image. Currently, the URL shows as “/content/orgname/aem/images/img.jpg”. How can I remove or rewrite “/content/orgname/aem”  not appearing so that users don’t see it in the image URL?

 

thanks ,

Renju

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Avatar

Community Advisor

Hi @RenjuSh,

Configure Sling Resource Resolver mappings and make sure your components use mapping when rendering links.

OSGi config (Cloud: code-only, e.g., config.publish)
org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator.cfg.json

{
  "resource.resolver.mapping": [
    "/content/orgname/aem/:/"
  ]
}

 OR
Via Dispatcher: Expose a short public path and internally rewrite it to the long JCR path.

httpd vhost (Dispatcher)

RewriteEngine On

# Public -> internal
RewriteRule ^/images/(.*)$ /content/orgname/aem/images/$1 [PT,L]

Dispatcher cache rules (so short paths cache):

/cache
  {
    /rules {
      /0001 { /glob "/images/*" /type "allow" }
    }
  }

Then update your components/templates to use /images/... in markup. (Inbound rewrites alone won’t change the hover unless the HTML uses the short path.)


Santosh Sai

AEM BlogsLinkedIn