StripHtmlExtension has no effect on vanity 302 redirection | Community
Skip to main content
Level 2
Jan 31, 2018 10:34 AM UTC
Solved

StripHtmlExtension has no effect on vanity 302 redirection

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.
joerghoh
joerghohAccepted solution
Employee
Jan 31, 2018 8:42 PM UTC

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

Level 2
Feb 20, 2018 2:16 PM UTC

As workaround I have added following rewrite rule in Apache:

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

Translate
joerghoh
joerghohAccepted solution
Employee
Jan 31, 2018 8:42 PM UTC

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

Translate
kautuk_sahni
Employee
Jan 31, 2018 11:04 AM UTC

Jörg Hoh​ Need your help here.

-Kautuk

Translate
Kautuk Sahni