Prevent Vanity/Redirect service from appending .html | Adobe Higher Education
Skip to main content
Level 3
August 3, 2023
解決済み

Prevent Vanity/Redirect service from appending .html

  • August 3, 2023
  • 1 の返信
  • 1133 ビュー

When using the OOTB vanity URL service, the service is appending .html to all endpoint vanities. We don't want this to occur. A couple of things to note, we already have extensionless URLs configured in AEM for our site, and we have URL rewrite conditions in the dispatcher to remove .html. 

 

The reason we want to prevent the vanity service from appending .html is because this is creating many redirect chains, because of the rewrite condition. 

 

How can we prevent the vanity service from appending .html?

 

EDIT:

This may be more in line with a change that needs to occur with the redirect service, as using the OOTB redirect property also append .html.

このトピックへの返信は締め切られました。
ベストアンサー mmasonWD

I just discovered it's an OOTB servlet that is appending the .html to internal redirects. com.day.cq.wcm.foundation.impl.PageRedirectServlet#doGet

 

https://experienceleague.adobe.com/docs/experience-cloud-kcs/kbarticles/KA-15857.html?lang=en

1 の返信

Shashi_Mulugu
Community Advisor
Community Advisor
August 4, 2023

@mmasonwd OOTB vanity service uses your etc/maps to create fully qualified urls. Can you please confirm and post what's your etc/maps says and what's your sample url pattern and whats expected.

mmasonWD作成者
Level 3
August 4, 2023

Hi Shashi,

 

Sample URL would be example.com/example/region/about-us has a vanity URL of "about-us" and the "redirect vanity url" checkbox checked. 

 

Expected is for the address to then resolve to "example.com/region/about-us" (region still included because redirect checkbox checked). Instead, it resolves to "example.com/region/about-us.html". And since we have rewrite conditions in our dispatcher, the .html will indeed be removed from the URL, BUT, it causes an additional redirect which we do not want. 

 

We would prefer that the vanity url redirect, redirects to the URL without appending the .html ever. 

 

I looked around a bit and tried to familiarize myself with how our configs for the resource resolver factory are set. We have the map.location directed to /etc/map.publish and numerous sling:mapping nodes. I went to the extreme for an initial test on one of our lower environments, and for testing purposes, completely removed this https node under map.publish. After clearing dispatcher and waiting a while, the vanities were still redirecting the exact same way? I would not have expected this.

 

Something else I familiarized myself with a bit from the link below was the /system/console/jcrresolver. All created vanities are included in this list, and I noticed that each of the created vanities that had the redirect vanity url checked, had .html appended in the "replacement" column. What service or configuration would still be appending the .html here?

 

link:

https://experienceleague.adobe.com/docs/experience-manager-learn/ams/dispatcher/disp-vanity-url.html?lang=en