Need to internally redirect an URL

Avatar

Avatar

karthikfordreal

Avatar

karthikfordreal

karthikfordreal

13-08-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

840

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

840
Arun_Patidar
MVP

14-08-2020

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

 

Answers (2)

Answers (2)

Avatar

Avatar

Nikhil-Kumar

MVP

Avatar

Nikhil-Kumar

MVP

Nikhil-Kumar
MVP

16-08-2020

Hi @karthikfordreal,

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

Avatar

Avatar

Vijayalakshmi_S

MVP

Avatar

Vijayalakshmi_S

MVP

Vijayalakshmi_S
MVP

14-08-2020

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/