Rewrite rendered page URL in component model | Community
Skip to main content
Level 6
February 28, 2022
Solved

Rewrite rendered page URL in component model

  • February 28, 2022
  • 1 reply
  • 768 views

Hi

I need to rewrite the rendered page URL in AEM 6.5.11 in a java component model depending on certain conditions. What method do I use for rewriting the url? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

By default AEM rewrites (that means the conversion from a repository path to the path part of a URL) all URLs when they are rendered as part of a HTML response. In this case you don't need to do anything.

 

There might be cases, where you want to convert a repository path to an URL path within JSON output. Use [1] to rewrite the path.

 

[1] https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#map-javax.servlet.http.HttpServletRequest-java.lang.String-

1 reply

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
March 4, 2022

By default AEM rewrites (that means the conversion from a repository path to the path part of a URL) all URLs when they are rendered as part of a HTML response. In this case you don't need to do anything.

 

There might be cases, where you want to convert a repository path to an URL path within JSON output. Use [1] to rewrite the path.

 

[1] https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html#map-javax.servlet.http.HttpServletRequest-java.lang.String-