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

SOLVED

Need to internally redirect an URL

karthikfordreal
Level 1
Level 1

Hi

 

I'm new to AEM, I need to suppress content path in the URL, for example :this link as has to redirect from https://www.act.com/content/odc/odc/un/en.html  to https://www.act.com/un  

 

In author, i configured /content/odc/odc/un/en.html this page for a hyperlink text component, when i replicate it and clicked the hyperlink test it is going https://www.act.com/content/odc/odc/un/en.html but i need  https://www.act.com/un  to be shown to the end customers.

 

 

Can anyone help me on this. Please guide me with steps to proceed on this.

 

Thanks in advance

1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

You have to configure at

1. config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml
resource.resolver.mapping="[/:/,/content/odc/odc/:/]"

2. Link Rewrite to remove /en.html

3. mapping at apache httpd server when request comes to AEM

or 

Mapping and reverse mapping at /etc/map

 

https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

 

View solution in original post

3 Replies
Vijayalakshmi_S
Community Advisor
Community Advisor

Hi @karthikfordreal,

Updating the content/resource path to URL/shortened URL is called forward mapping. This can be handled by using OSGI config named - Apache Sling Resource Resolver Factory.

Description on "URL mappings" property helps understand the significance and syntax 

Try this in your local publish environment first and then next higher environments.

 

Below sample entry for reference:

This lets the we retail page - http://localhost:4503/content/we-retail/us/en/equipment.html to be accessed as http://localhost:4503/equipment.html

Links as part of anchor tag will also be updated to shortened path. (have used ":" for two way mapping)

Vijayalakshmi_S_0-1597419638956.png

 

Below blog post provides a clear understanding on mapping.

https://cqdump.wordpress.com/2016/01/13/resource-path-vs-url-and-rewriting-links/

 

Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

You have to configure at

1. config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml
resource.resolver.mapping="[/:/,/content/odc/odc/:/]"

2. Link Rewrite to remove /en.html

3. mapping at apache httpd server when request comes to AEM

or 

Mapping and reverse mapping at /etc/map

 

https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

 

View solution in original post

Nikhil-Kumar
Community Advisor
Community Advisor

Hi @karthikfordreal,

Try using etc/map in publish mode for internal redirects, it's explained in Internal Redirects