Expand my Community achievements bar.

SOLVED

JCR Resource Resolver mappings with regex(removing parts of url in a certain way)

Avatar

Community Advisor

Trying to configure JCR Resource resolve in a certain way:

Given requirement:

Where article has path /content/company/en/articles/some/article should be resolved as /some/article

Tried to use this Url Mappings rule (resource.resolver.mapping):

/content/company/en/articles/(.*):/$1

This works in the system console and places like sitemap.xml where ResourceResolver.map is invoked.

However, when trying to open the actual page, following error is returned:

No resource found

Cannot serve request to /some/article.html on this server


 

What is wrong with current configuration ?

 

Thanks,

Peter

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Found that it is possible to solve without the use of regex, simply put /content/company/en/articles/:/ this will resolve everything that starts with articles/ to the root /

View solution in original post

4 Replies

Avatar

Community Advisor

Thank you for your reply Scott.

Have already read through the sling docs page and url mapping and deep linking.

These articles do not tend to give answer to my particular problem since they both focus on mappings through /etc/map which I am not allowed to use due to some business requirement. All the mappings need to be done through OSGi console. After adding mapping regex in OSGi console 404 error is returned when page is opened.

How should I setup regex for it to work in the OSGi console(given the example described before) ?

Thanks,

Peter

Avatar

Correct answer by
Community Advisor

Found that it is possible to solve without the use of regex, simply put /content/company/en/articles/:/ this will resolve everything that starts with articles/ to the root /