We are trying to use Sling Mappings to map incoming requests to the correct resource, as well as outgoing links to the public (/aliased) URLs.
Our sites exist under /content/c-<sitename> and are accessible at www.organization.com/<sitename>;. Our localized content lives in parallel subtrees for each locale (pt_PT, es_ES, etc), but we wish to enforce the notion of a default locale which is omitted from the request path. Some scenarios are (assuming default local is de_DE):
1) www.organization.com/<sitename>/ <---> /content/c-<sitename>/de_DE 2) www.organization.com/<sitename>/machines.html <---> /content/c-<sitename>/de_DE/machines 3) www.organization.com/<sitename>/de_DE/machines.html <---> (301 Redirect) www.organization.com/<sitename>/machines.html 4) www.organization.com/<sitename>/fr_FR.html <---> /content/c-<sitename>/fr_FR 5) www.organization.com/<sitename>/fr_FR/machines.html <---> /content/c-<sitename>/fr_FR/machines
Our current mappings are configured for this particular <sitename>:
{ sling: internalRedirect: "/content/c-sitename", jcr: primaryType: "sling:Mapping", sling: match: "www.organization.com/sitename", de_DE_root: { sling: internalRedirect: ["/content/c-sitename/de_DE.html"], jcr: primaryType: "sling:Mapping", sling: match: "$" }, de_DE_redirect: { sling: redirect: "/sitename/$1", sling: match: "de_DE/(.+)$", jcr: primaryType: "sling:Mapping" }, de_DE_pages: { sling: internalRedirect: ["/content/c-sitename/de_DE/$1"], jcr: primaryType: "sling:Mapping", sling: match: "(.+)$" }, other_pages: { sling: internalRedirect: ["/content/c-sitename/$1"], jcr: primaryType: "sling:Mapping", sling: match: "([a-z]{2}_[A-Z]{2}/.+)$" } }
Given those mappings, we have satisfied all scenarios above for resource resolving. The reverse mappings are working except for one, which corresponds to scenarios #2/#3. For pages under the default locale (de_DE), we would like the outgoing links to be rewritten without the locale. Currently:
/content/c-<sitename>/de_DE ---> www.organization.com/<sitename>/
working /content/c-<sitename>/de_DE/machines ---> www.organization.com/<sitename>/machines.html
not working (includes /de_DE) /content/c-<sitename>/de_DE/tools ---> www.organization.com/<sitename>/tools.html
not working (includes /de_DE)
And the generated mappings (from Felix console: /system/console/jcrresolver):
Mapping Map Entries ^/content/c-sitename/de_DE.html$ http://www.local.com:4502/sitename/ external: 302 (mapping: de_DE_root) ^/content/c-sitename http://www.local.com:4502/sitename external: 302 (mapping: other_pages)
What is necessary to generate the missing mapping (and ensure that is takes precedence over ^/content/c-sitename):
^/content/c-sitename/de_DE http://www.local.com:4502/sitename external: 302 (mapping: de_DE_pages)
Thanks!