[ https://issues.apache.org/jira/browse/SLING-11352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Csaba Varga updated SLING-11352: -------------------------------- Description: 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. was: 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. > 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 > > 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.7#820007)