Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Reverse Mapping in /etc/map

Avatar

Avatar
Validate 1
Level 2
ignacio_mancill
Level 2

Likes

2 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 3
Give Back
Boost 1
View profile

Avatar
Validate 1
Level 2
ignacio_mancill
Level 2

Likes

2 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 3
Give Back
Boost 1
View profile
ignacio_mancill
Level 2

20-09-2018

Hi there,

We have a request where we are using etc/map for rewrite URLs of our site but now we need to have a reverse mapping in order to get the valid path to show in all links in the site.

Our Sling mapping (not reverse) is the next one:

sling:internalRedirect

String

/content/site/es/es/$1.html

sling:match

String

localhost.4502/es/(.*)$

Now, we are trying to get the inverse, when resolving the url by /content/site/es/es/page we need to have the domain/es/page with

getResourceResolver().map(resourcePath)

e.g. localhost:4502/es/folder/page serves the content of /content/site/es/es/folder/page. This behavior is ok.

The issue is that every href in the page (fetched by resource resolver) are invalid links serving:  /content/site/es/es/folderx/pagex and not: localhost:4502/es/folderx/pagex

Do you have any idea how to create these reverse rules or if we are thinking on the correct way to have valid links in the site?

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

20-09-2018

Hi,

you can try to create new node in /etc/map with below value for reverse mapping.

sling:internalRedirect

String

/content/site/es/es/(.*).html

sling:match

String

localhost.4502/es/$1

I am not sure what is your use case here, if you are just creating shortened url then you can create reverse mapping like above and to map short urls to actual content you can create mapping.

Answers (0)