Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Sling Internal Redirect with Alias

Avatar

Level 1

Hi there, 

 

We have a request to convert a url like this:

/en/page/child to /en/page.child

So we are using a sling internal redirect rule to resolve this as the next one working as expected: 

rule

jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/en/page/$1]"

sling:match="content/en/page.(child)"

reverse_rule

jcr:primaryType="sling:Mapping"
sling:internalRedirect="[content/en/page/(child)]"

sling:match="content/en/page.$1"

 

The same rule is applied in another language, for example spanish with a particular thing, it has a sling:Alias.

You can find the node in crx as /es/page/child but if alias is applied it become /es/pagina/hija so we are applying the next rule: 

rule

jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/es/pagina/$1]"

sling:match="content/es/pagina.(hija)"

reverse_rule

jcr:primaryType="sling:Mapping"

sling:internalRedirect="[content/es/pagina/(hija)]"

sling:match="content/es/pagina.$1"

 

The same rule as in english is throwing too many redirects. Does anyone knows if this kind of rule should be changed as we are using sling:alias in the page node? 

 

Regards-

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Try setting up a DEBUG logger on "org.apache.sling.resourceresolver" and you can how resource resolution is happening in the backend and update your rules accordingly.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Try setting up a DEBUG logger on "org.apache.sling.resourceresolver" and you can how resource resolution is happening in the backend and update your rules accordingly.