Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Vanity URL - Exclude from dispatcher pass through redirects

Avatar

Level 2

Hi,

 

We have a Vanity URL setup at page level on AEM and with the default settings, it works fine.

https://helpx.adobe.com/experience-manager/kb/ams-dispatcher-manual/disp-vanity-url.html 

 

I also have a "resource mapping" setup to define redirects, and vanity URLs so that the internal structure of AEM content is hidden from the visitors. To achieve this, I have set up a passthrough redirect at the dispatcher's end (similar to https://github.com/adobe/aem-guides-wknd/blob/main/dispatcher/src/conf.d/rewrites/rewrite.rules#L21-...).

 

Due to this scenario, vanity URLs are getting 404 though there are part of vanity URL file.

 

Is it possible to exclude vanity URLs from these redirects or is any alternative solution available?

 

 

2 Replies

Avatar

Employee Advisor

Can you please provide an example, what it actually does and what you are expecting to achieve.

Avatar

Level 2

Hi @Jörg_Hoh 

 

Let's say I have a site http://www.example.com and a page with the content path /content/businessunit/branch/locale/home/about.html

I have a setup vanity URL for the page "about" as "vanity-aboutus". Now the page can be accessed at http://www.example.com/vanity-aboutus

Now, additional two things -

[1] I have set up a sling mapping for URL shortening as follows:

sling:internalRedirect="/content/businessunit/branch/locale/home((\.html)|/(.*))"
sling:match="www.example.com/$3"

[2] Pass through AEM content paths for enabling proper dispatcher caching.

RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteRule ^/(.*)$ /content/businessunit/branch/locale/home/$1 [PT,L]

I configure AEM to process the vanity before sling map (using the property Vanity Path Precedence in resource resolver).
Now, due to sling mapping and dispatcher redirect rules, the vanity URLs pass through the site home page and resulting in a 404 response.