AEM internal Redirect and Resolve nested content

Avatar

Avatar

jithinn9287936

Avatar

jithinn9287936

jithinn9287936

01-09-2019

Hi,

I have the below content structure.

- site

          - de

                   - category1

                             - 2001

                                   - quarter1

                                        - blog_about_vegan

                                        - blog_about_flowers

                                   - quarter2

                                        - blog_about_something

                             - 2002

                                   - quarter1

                                        - blog_about_vegan

                                        - blog_about_flowers

                                   - quarter2

                                        - blog_about_something

I want customers to use shorthand urls. For instance; Customer should get blog_about_vegan when he tries the following url : https://www.somedomain.com/site/de/category1/blog_about_vegan. He should not be worried about the year and quarter as they are just meant for categorization.

I have configured sling mappings in /etc/map to remap the url to search for content in /content. But i am not able to figure out how can I ask sling to look into all year and quarter folders for a particular category to find this article. something like a dynamic internal redirect with nested search capability. could you please advice

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

jbrar

Employee

Avatar

jbrar

Employee

jbrar
Employee

02-09-2019

I believe you need to use dynamic redirects which can be implemented at the apache level(mod_rewrite module). Check [1] for more details:

https://stackoverflow.com/questions/41745351/how-to-redirect-multiple-dynamic-urls-with-apache 

Answers (8)

Answers (8)

Avatar

Avatar

hamidk92094312

Employee

Avatar

hamidk92094312

Employee

hamidk92094312
Employee

02-09-2019

Check the following document about resource mapping to define redirects, vanity URLs and virtual hosts for AEM.

Resource Mapping

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.1K

Correct Reply

839

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.1K

Correct Reply

839
Arun_Patidar
MVP

02-09-2019

why don't you use vanity url in this case?

Avatar

Avatar

dennyj13354090

Avatar

dennyj13354090

dennyj13354090

05-09-2019

Hi,

Which page should be displayed if user entered the url  /quarter1/blog_about_vegan ?

2001/quarter1/blog_about_vegan

Or

2002/quarter1/blog_about_vegan

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

952

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

952

Correct Reply

1.0K
Jörg_Hoh
Employee

03-09-2019

I would not recommend to use filters to change the resource in the request; might work, but it's not really intuitive and also heavily depends on the order of the filters. Maybe a custom resource provider is more in line with Sling and could help here. It's also more generic and works then with all resource-based functionality of sling, and is not tied to a request.

Jörg

Avatar

Avatar

Gaurav-Behl

MVP

Avatar

Gaurav-Behl

MVP

Gaurav-Behl
MVP

03-09-2019

If I'm not wrong, a combination of Sling Filters and Processors might work for this use case.

Avatar

Avatar

jithinn9287936

Avatar

jithinn9287936

jithinn9287936

03-09-2019

I tried these configurations. But I cannot make it work for the year and quarter parts of the url which are unknown and supposed to be dynamic

Avatar

Avatar

jithinn9287936

Avatar

jithinn9287936

jithinn9287936

03-09-2019

I cannot do this because I will be ambiguos of the path that i need to redirect at dispatcher

Avatar

Avatar

jithinn9287936

Avatar

jithinn9287936

jithinn9287936

03-09-2019

I could use Vanity url as a solution. But Either the author have to manually add Vanity url for each page, which i dont want or I have to dynamically generate a vanity url based on the parent path and set it in workflow step.

But I was moreover looking to do this as a configuration in sling mapping.