Sling Internal Redirect with Alias

naxtyn_

29-04-2020

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-

AEM 6.5 mappings rules sling

Accepted Solutions (1)

Accepted Solutions (1)

jbrar

Employee

01-05-2020

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.

Answers (0)