Sling Internal Redirect with Alias | Community
Skip to main content
Level 2
April 29, 2020
Solved

Sling Internal Redirect with Alias

  • April 29, 2020
  • 1 reply
  • 3368 views

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-

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 user05162

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.

1 reply

user05162Adobe EmployeeAccepted solution
Adobe Employee
May 1, 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.