URL redirects
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:
- AEM as a Cloud Service has built-in CDN, however, customers can provide a CDN (BYOCDN) in front of AEM-managed CDN.
- 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:
Solution options
The following are solution options in the order of being closer to the website visitor’s browser.
At Edge via AEM-managed CDN at-edge-via-aem-managed-cdn
This option is only available for AEM as a Cloud Service customers.
The AEM-managed CDN provides a redirection solution at the Edge level thus reducing round trips to the origin. The Client-side Redirects feature allows you to configure the redirect rules in the AEM project code and deploy using the Config Pipeline. The CDN configuration file (cdn.yaml
) size should not exceed 100KB.
Managing redirects at Edge or CDN level has performance advantages.
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 defined 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 the 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. It 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 helps AEM administrators to easily maintain and publish Apache RewriteMap files without directly accessing the 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 both AEM as a Cloud Service (see Pipeline-free URL Redirects strategy) and AEM 6.x 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 the 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.
- Enabling the marketing team or super users to manage redirect rules without the AEM development team and the AEM deployments.
- The Process to manage, verify, track, and revert the changes or risk mitigation.
- Availability of Subject Matter Expertise for At Edge via CDN Service solution.