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
  • 5894 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 17, 2024

I tried this as well but for me it is still not working. 

 

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
Saumya
SaumyaAuthor
Level 2
April 19, 2024

Not yet. None of the above answers is working for cloud publish environment. Hence still debugging.

Have raised an adobe support ticket as well. Will update as soon as i get the solution.

Level 2
August 19, 2024

Hey , did you find a resolution for this as we are facing the same issue?