Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Not exposing the "/content/dam/project" and "/content/project " in redirect urls


Level 3

Hi Everyone,

I have a requirement for not exposing the "/content/dam/project" and "/content/project" in the rendered html so users do not get to see the internal paths.

If we need to sling redirect URL mapping. How can we achieve it? Please explain with example.

We have used a method to remove the /content/project from all <a href> of the HTML using the below method.

     * This method is used for reverse map the urls on page.  
     * @retrun- if url start with /content it remove the /content/proj& append html to url.
     * @ retrun- if url is null, blank or not start with /content than it return the same url.
    public String getResourceResolverMapURl(SlingHttpServletRequest slingRequest, String  url ){

        if(url!=null && !"".equals(url) && (url.startsWith("/content/proj") || url.startsWith("/content/dam"))){
            String extension = "";
            int index = url.lastIndexOf('.');
            if (index >= 0) {
                extension = url.substring(index+1).toUpperCase();
            return slingRequest.getResourceResolver().map(slingRequest, url );
            return url;

We have 6500 url s still getting redirected to /content/project or /content/dam . 

Any help would be greatly appreciated.


1 Reply