Hide content path for assets | Community
Skip to main content
Level 2
September 13, 2025
Solved

Hide content path for assets

  • September 13, 2025
  • 2 replies
  • 934 views

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

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 15, 2025
SantoshSai
Community Advisor
Community Advisor
September 15, 2025

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