Skip to main content
Level 2
November 20, 2025
Solved

AEM redirect rule for Dam path

  • November 20, 2025
  • 3 replies
  • 214 views

Hi Team,

 

We received a customer request on below requirement, 

 

If we hit the domain (eg: abc.com) it should redirected to particular dam page /content/dam/demo.pdf

 

It will be helpful, if someone could provide me the exact rewrite rule for this.

 

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by giuseppebaglio

hi @anushaat 

you can add this mod_rewrite rewrite rule to your Dispatcher configuration (e.g., in rewrites/rewrite.rules or your virtual host configuration):

RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [L,R=301]

Alternative (with PT flag for internal rewriting):

RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [PT,L]

Here is the explanation of flags:

FlagPurpose
^/$Matches only the root path (/)
R=301Sends a permanent redirect (301) to the browser
PTPass Through - internally rewrites without sending redirect to browser
LLast rule (stops processing further rules)

Super small example of a virtual host (just for demo purpose):

<VirtualHost *:80> ServerName abc.com RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [L,R=301] </VirtualHost>
 
If you're using AEM as a Cloud Service, consider using the Pipeline-free URL Redirects feature instead:
  1. Create a rewrite map file in DAM at /content/dam/redirectmaps/mysite-redirectmap.txt

  2. Add the mapping:

/ /content/dam/demo.pdf
  • Configure the Apache rewrite rule to use this map (managed via managed-rewrite-maps.yaml)

With this approach, you enable business users to manage redirects without requiring code deployment.

3 replies

giuseppebaglio
giuseppebaglioAccepted solution
Level 10
November 20, 2025

hi @anushaat 

you can add this mod_rewrite rewrite rule to your Dispatcher configuration (e.g., in rewrites/rewrite.rules or your virtual host configuration):

RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [L,R=301]

Alternative (with PT flag for internal rewriting):

RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [PT,L]

Here is the explanation of flags:

FlagPurpose
^/$Matches only the root path (/)
R=301Sends a permanent redirect (301) to the browser
PTPass Through - internally rewrites without sending redirect to browser
LLast rule (stops processing further rules)

Super small example of a virtual host (just for demo purpose):

<VirtualHost *:80> ServerName abc.com RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ /content/dam/demo.pdf [L,R=301] </VirtualHost>
 
If you're using AEM as a Cloud Service, consider using the Pipeline-free URL Redirects feature instead:
  1. Create a rewrite map file in DAM at /content/dam/redirectmaps/mysite-redirectmap.txt

  2. Add the mapping:

/ /content/dam/demo.pdf
  • Configure the Apache rewrite rule to use this map (managed via managed-rewrite-maps.yaml)

With this approach, you enable business users to manage redirects without requiring code deployment.

ManviSharma
Adobe Employee
Adobe Employee
November 20, 2025

Hello @anushaat ,

 

You don’t need anything complex here. A single rule that maps the bare domain / to /content/dam/demo.pdf is enough.

If your site is fronted by Apache HTTPD (classic Dispatcher setup), add this to your vhost (inside the right <VirtualHost> block and after RewriteEngine On.

# If the request is just the bare domain (root), redirect to the DAM asset
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ /content/dam/demo.pdf [R=301,L]

Example for HTTPS-only virtual host:

<VirtualHost *:443>
    ServerName abc.com
    # … SSL and Dispatcher config …

    RewriteEngine On

    # Redirect root to DAM asset
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule ^$ /content/dam/demo.pdf [R=301,L]

    # …other rules…
</VirtualHost>

 

muskaanchandwani
Adobe Employee
Adobe Employee
November 20, 2025

Hello @anushaat 

If this is AEMaaCS, you can also do this at the CDN Level.

The AEM-managed CDN provides a redirection solution at the Edge level thus reducing round trips to the origin.
The Server-side Redirects feature allows you to configure the redirect rules in the AEM project code and deploy using the Config Pipeline.

kind: "CDN" version: "1" data: redirects: rules: - name: redirect-root-to-dam when: reqProperty: path equals: "/" action: type: redirect status: 301 location: /content/dam/demo.pdf


Reference :

https://experienceleague.adobe.com/en/docs/experience-manager-learn/foundation/administration/url-redirection

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-configuring-traffic?lang=en#server-side-redirectors