StripHtmlExtension has no effect on vanity 302 redirection | Community
Skip to main content
Level 2
January 31, 2018
Solved

StripHtmlExtension has no effect on vanity 302 redirection

  • January 31, 2018
  • 3 replies
  • 1710 views

Hi all,

In our setup we have configured AEM (6.3) not use use any extension in URLs.

So we have configured author + publish with StripHtmlExtension equals to true for Link Checker Transformer.

This is working perfectly for pages being sent to the browser. All links in the response are stripped from their extension.

It is only not working for the Location 302 redirect by a vanity. The location still contains a .html suffix.

The Link Checker Transformer has no effect on this vanity redirect.

When I enter a vanity in JCR resource resolver I get following back:

http://localhost:4503/vanity -->

RedirectResource, type=sling:redirect, path=/vanity, values={sling:target=/content/www-mysite-be/nl/page.html, sling:status=302}

How can we make sure that this extension in sling:target is also stripped?

PS. I read all forum entries on using html suffix or not and also the pros/cons from SEO perspective. I'm aware of all these topics, but still we want to go extension less. AEM seems to officially support it with the StripHtmlExtension config but it's not a bulletproof solution and according to this discussion not working for vanities.

Thanks in advance.

Johnny

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 joerghoh

From what I understand this is hardcoded. Changing it would require a patch to the Sling mapping code (see [1]). Maybe you want to raise this as a ticket first in the Apache Sling Jira [2].

Jörg

[1] sling-org-apache-sling-resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping at 731ff38331957d17…

[2] https://issues.apache.org/jira/browse/SLING

3 replies

kautuk_sahni
Community Manager
Community Manager
January 31, 2018

Jörg Hoh​ Need your help here.

-Kautuk

Kautuk Sahni
joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
January 31, 2018

From what I understand this is hardcoded. Changing it would require a patch to the Sling mapping code (see [1]). Maybe you want to raise this as a ticket first in the Apache Sling Jira [2].

Jörg

[1] sling-org-apache-sling-resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping at 731ff38331957d17…

[2] https://issues.apache.org/jira/browse/SLING

Level 2
February 20, 2018

As workaround I have added following rewrite rule in Apache:

Header edit Location ^/(.+)\.html$ /$1