Expand my Community achievements bar.

SOLVED

How to redirect a Page request to another Page in a different AEM Instance ?

Avatar

Level 2

Hello, I would like to explore the Redirection options available for one of our scenario. We have Two different AEM instances for different purposes (NOT meaning a stand-by instance here).
When there is a page request to 'PAGE A' located in AEM Instance-1, we want a different page, say 'PAGE B' on AEM Instance-2 to be served.  I am aware of options like Page Redirect configurations on Page Properties, Dispatcher Url rewriting etc, Kindly suggest the most Optimal & Flexible option to achieve this redirection.

Also kindly clarify if "Page Redirection" field under the Advanced Page Properties has the capacity to redirect to other page within the Same instance only ? 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Fastest redirect is the one happening closest to client browser. Client-side redirects is not an option. The next closest choice would be CDN redirects. Do you have Akamai/Fastly CDN? Edge redirector is the best option. If no, next layer is Apache Http server using Dispatcher rules. You can write Proxy rewrites, so first AEM dispatcher will reverse proxy to second AEM server. 

 

I have used RewriteMap

A very good option. Basically write a servlet that returns exact .txt map file entries. Map file is stored at dispatcher. It was AEM6.5 Onprem. We had cron job running on jenkins that nightly refreshes this .txt mapfile.Every request, apache asserts against Map entry and redirects accordingly. Same can be elevated to CDN edge redirector if tool allows. 

 

Preferably avoid AEM server-side redirects like Sling redirects or the ACS Commons tool. We want to avert traffic hitting AEM server. Reduce AEM traffic and divert at higher layers. Try CDN or stick to dispatcher only. 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @PrasanthAnandharaj 

where a request for 'PAGE A' on AEM Instance-1 should be redirected to 'PAGE B' on AEM Instance-2, you can consider the following options:

  1. Dispatcher Url Rewriting:

    • This involves configuring the Apache Dispatcher module on your web server to rewrite URLs. You can define rules in the dispatcher.any file to rewrite requests for 'PAGE A' on Instance-1 to 'PAGE B' on Instance-2.
    • This approach is efficient at the web server level and does not require modifications within AEM.
  2. AEM Vanity URLs and Redirects:

    • Set up a Vanity URL for 'PAGE A' on AEM Instance-1 that redirects to 'PAGE B' on AEM Instance-2. This can be configured in the page properties by adding a mapping in the "Vanity URLs" tab.
    • This method is more AEM-centric and allows you to manage redirects within the AEM authoring environment.
  3. Servlet and Sling Mapping:

    • Create a custom servlet or use Sling mappings to intercept requests for 'PAGE A' on Instance-1 and programmatically redirect them to 'PAGE B' on Instance-2.
    • This option provides more flexibility for custom logic but requires coding.


Avatar

Level 2

Thanks for the valuable inputs. Let me explore more on the Url Rewriting.

Avatar

Correct answer by
Level 4

Fastest redirect is the one happening closest to client browser. Client-side redirects is not an option. The next closest choice would be CDN redirects. Do you have Akamai/Fastly CDN? Edge redirector is the best option. If no, next layer is Apache Http server using Dispatcher rules. You can write Proxy rewrites, so first AEM dispatcher will reverse proxy to second AEM server. 

 

I have used RewriteMap

A very good option. Basically write a servlet that returns exact .txt map file entries. Map file is stored at dispatcher. It was AEM6.5 Onprem. We had cron job running on jenkins that nightly refreshes this .txt mapfile.Every request, apache asserts against Map entry and redirects accordingly. Same can be elevated to CDN edge redirector if tool allows. 

 

Preferably avoid AEM server-side redirects like Sling redirects or the ACS Commons tool. We want to avert traffic hitting AEM server. Reduce AEM traffic and divert at higher layers. Try CDN or stick to dispatcher only. 

Avatar

Level 2

Thanks for the valuable suggestions. Understand that the better solution is to redirect on the top level of the landscape.