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
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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.)
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies