[ https://issues.apache.org/jira/browse/SLING-11352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17934012#comment-17934012 ]
Joerg Hoh commented on SLING-11352: ----------------------------------- There is such a mapping, but the path is actually /etc/map/example.com.80 and therefor includes a hostname. I don't see that in your example, and for that I think that this is a new feature. In best TDD tradition I would start with a series of unittests, which can act as specification for this behavior, and then implement the necessary changes. The URL mapping in Sling is quite complex in all its nuances, and for that I think that we should have a good unit test coverage across all situations. But I think we are not there. Can you specify the desired behavior here in the ticket in a structured way (that means content structure and the expected results), so it's possible to translate it into tests? Thanks your help! > 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)