URL rewriting in AEM cloud using etc/maps and resource resolver mappings | Community
Skip to main content
Saumya
Level 2
April 16, 2024

URL rewriting in AEM cloud using etc/maps and resource resolver mappings

  • April 16, 2024
  • 3 replies
  • 5892 views
Hi AEM community,
 
I'm currently working on implementing URL rewriting as mentioned below:
 
From: `/content/test/en/gyms/services/personal-training/location`
To: `/gyms/location/services/personal-training`
 
The goal is to have the public-facing URL as `/gyms/location/services/personal-training`, which will correspond to the internal URL of `/content/test/en/gyms/services/personal-training/location.html`.
 
I've configured the etc/map mapping and resource resolver config entries accordingly (please see the attached screenshots).
While this setup works flawlessly in the local publisher environment, it's encountering issues when deployed to AEM cloud publish environments. Additionally, we have a link transformer configuration in place to transform the href of these pages which is also not working (maybe because rewrites are not happening) (as shown in the attached screenshot).
 
Can anyone please help on how to make it work in AEM cloud publish environments ?
Also, what is the correct place to add etc/mappings - under ui.apps or ui.content in the repo ?
 
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

aanchal-sikka
Community Advisor
Community Advisor
April 17, 2024

@saumya 

 

We have created sling mappings in following location

 

Sling Mappings are capable to altering URLs in pages. 

 

Please refer to https://youtu.be/bJ_cXcAE7G8?t=1080  It explains both forward and reverse

Aanchal Sikka
Saumya
SaumyaAuthor
Level 2
April 19, 2024

Can you help me with what should be the value of "resource.resolver.map.location" property in this config org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json ?

 

should it be /conf path or /etc path ?

 

RikVanB
Level 2
April 17, 2024

Hi @saumya 

To already answer your question about where to store it, it should be below ui.apps.

Can you send me the path where you added the Resource Resolver Configuration in your project?

Greetings

Rik

Saumya
SaumyaAuthor
Level 2
April 17, 2024

It is under ui.config/src/main/content/jcr_root/apps/<project-folder>/osgiconfig/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json

RikVanB
Level 2
April 17, 2024

And do you hvae one configured for a specific environment in ui.config/src/main/content/jcr_root/apps/<project-folder>/osgiconfig/config.[environment].publish?

 

Because that would overwrite the more generic one.

Also to verify if your configuration is deployed correctly you can go to the developer console and print all the OSGi Configurations from the publishers and search for your configurations.


Here you have a step-to-step guide on how to get OSGi Configurations through the developer console.

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 18, 2024

@saumya Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Esteban Bustamante
bhavigoyal
Level 4
April 19, 2024

Hi, Please can you tell how to mark correct a answer?? For that we have to post a question or we can mark correct previous answers also given on any other questions??

And how to do that??

aanchal-sikka
Community Advisor
Community Advisor
August 20, 2024

@bhavigoyal 

 

You are correct... Since this is a discussion, we cannot designate a single answer as correct.

The community members were trying to keep the status of resolved answers up to date, but they may have missed that this query was marked as a "Discussion" if it was accessed through the All Tab.

 

Thanks for paying attention to the note. Maybe just leave a reply under that fix that worked.

 

 

Aanchal Sikka