[ https://issues.apache.org/jira/browse/SLING-11352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17933978#comment-17933978 ]
Csaba Varga commented on SLING-11352: ------------------------------------- [~joerghoh] : The [example for reverse/outgoing mappings|https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html#regular-expressions-for-reverseoutgoing-mappings] in the documentation has a similar example, where sing:internalRedirect is a regex that matches a path. Specifying a path (instead of a protocol/server/path triple) is working on our AEM instances, and has been for years, so I expected the mappings in my reports to work as well. I'm not sure what is the expected approach when you need outgoing regex mappings. The hostname of an environment may vary between development, staging and production, so it doesn't feel wise to include it in the mapping rules. > Cannot create path-only mapping rule in /etc/map > ------------------------------------------------ > > Key: SLING-11352 > URL: https://issues.apache.org/jira/browse/SLING-11352 > Project: Sling > Issue Type: Bug > Components: ResourceResolver > Affects Versions: Resource Resolver 1.8.4 > Reporter: Csaba Varga > Priority: Minor > Time Spent: 1h 10m > Remaining Estimate: 0h > > I am trying to set up a mapping to make some of our site hierarchy appear on > a different URL than what would be dictated by the hierarchy. My goal is to > map the path /content/mycompany/locales/some_locale/sectionA to the URL > /some_locale/sectionB . (I don't want to override the protocol, host and port > fields.) Because we support multiple locales, I need to use a regex for > setting up the matches. Here is my original attempt: > {code:java} > /etc/map/my_mapping > +-- sling:internalRedirect = > /content/mycompany/locales/([-a-z]+)/sectionA > +-- sling:match = /$1/sectionB{code} > When this node is present, /content/mycompany/locales/en-us/sectionA/foo gets > mapped to /en-us://sectionB/foo instead of the intended /en-us/sectionB/foo. > I can work around the issue by avoiding forward slashes in sling:match, but > this is ugly and unclear : > {code:java} > /etc/map/my_mapping > +-- sling:internalRedirect = > /content/mycompany/locales/([-a-z]+)(/)sectionA > +-- sling:match = /$1$2sectionB {code} > Is this kind of mapping supported at all? I would rather avoid adding the > hostname to mapping rules because it is environment-specific. -- This message was sent by Atlassian Jira (v8.20.10#820010)