URL redirects

Last update: 2024-01-25
  • Created for:
  • Intermediate
    Developer

URL redirection is a common aspect as part of website operation. Architects and administrators are challenged to find the best solution on how and where to manage the URL redirects that provide flexibility and fast redirect deployment time.

Make sure you are familiar with the AEM (6.x) aka AEM Classic and AEM as a Cloud Service infrastructure. The key differences are:

  1. AEM as a Cloud Service has built-in CDN, however, customers can provide a CDN (BYOCDN) in front of AEM-managed CDN.
  2. AEM 6.x whether on-premise or Adobe Managed Services (AMS) does not include an AEM-managed CDN, and customers must bring their own.

The other AEM services (AEM Author/Publish, and Dispatcher) are otherwise conceptually similar between AEM 6.x and AEM as a Cloud Service.

AEM’s URL redirect solutions are as follows:

Managed & deployed as AEM project code Ability to change by marketing/content team AEM as Cloud Service compatible Where redirection execution happens
At Edge via bring your own CDN Edge/CDN
Apache mod_rewrite rules as Dispatcher config Dispatcher
ACS Commons - Redirect Map Manager Dispatcher
ACS Commons - Redirect Manager AEM
The Redirect page property AEM

Solution options

The following are solution options in the order of being closer to the website visitor’s browser.

At Edge via bring your own CDN

Some CDN services provide redirection solutions at the Edge level thus reducing round trips to the origin. See Akamai Edge Redirector, AWS CloudFront Functions. Please consult with your CDN service provider for Edge level redirection capability.

Managing redirects at Edge or CDN level has performance advantages, however they are not managed as part of AEM but rather discrete projects. A well-thought process to manage and deploy redirect rules is crucial to avoid problems.

Apache mod_rewrite module

A common solution uses Apache Module mod_rewrite. The AEM Project Archetype provides a Dispatcher project structure for both AEM 6.x and AEM as a Cloud Service project. The default (immutable) and custom rewrite rules are defined in the conf.d/rewrites folder and the rewrite engine is turned ON for virtualhosts that listens on port 80 via conf.d/dispatcher_vhost.conf file. An example implementation is available in the AEM WKND Sites Project.

In AEM as a Cloud Service, these redirect rules are managed as part of AEM code and deployed via Cloud Manager Web Tier config pipeline or Full-stack pipeline. Thus your AEM project-specific process is at play to manage, deploy, and trace the redirect rules.

Most CDN services do cache the HTTP 301 and 302 redirects depending on their Cache-Control or Expires headers. This helps to avoid the round trip after the initial redirect originating at Apache/Dispatcher.

ACS AEM Commons

There are two features available within ACS AEM Commons to manage URL redirects. Please note, ACS AEM Commons is a community-operated, open-source project and not supported by Adobe.

Redirect Map Manager

Redirect Map Manager allows AEM 6.x administrators to easily maintain and publish Apache RewriteMap files without directly accessing Apache Web server or requiring an Apache web server restart. This feature allows permissions users to create, update, and delete redirect rules from a console in AEM, without the help of the development team or an AEM deployment. Redirect Map Manager is NOT AEM as a Cloud Service compatible.

Redirect Manager

Redirect Manager allows the users in AEM to easily maintain and publish redirects from AEM. The implementation is based on Java™ servlet filter, thus typical JVM resource consumption. This feature also eliminates the dependency on the AEM development team and the AEM deployments. Redirect Manager is both AEM as a Cloud Service and AEM 6.x compatible. While the initial redirected request must hit AEM Publish service to generate the 301/302 (most) CDNs’ cache 301/302 by default, allowing subsequent requests to be redirected at the edge/CDN.

The Redirect page property

The out-of-the-box (OOTB) Redirect page property from the Advanced tab allows content authors to define the redirect location for the current page. This solution is best for per-page redirect scenarios and does not have a central location to view and manage the page redirects.

Which solution is right for implementation

Below are a few criteria to determine the right solution. Also, your organization’s IT and Marketing process should help to pick the right solution.

  1. Enabling the marketing team or super users to manage redirect rules without the AEM development team and the AEM deployments.
  2. The Process to manage, verify, track, and revert the changes or risk mitigation.
  3. Availability of Subject Matter Expertise for At Edge via CDN Service solution.

On this page