Expand my Community achievements bar.

SOLVED

Need to internally redirect an URL

Avatar

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

Avatar

Correct answer by
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

 



Arun Patidar

View solution in original post

3 Replies

Avatar

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/

 

Avatar

Correct answer by
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

 



Arun Patidar

Avatar

Community Advisor

Hi @karthikfordreal,

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