Expand my Community achievements bar.

SOLVED

StripHtmlExtension has no effect on vanity 302 redirection

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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...

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

View solution in original post

3 Replies

Avatar

Administrator

Jörg Hoh​ Need your help here.

-Kautuk



Kautuk Sahni

Avatar

Correct answer by
Employee Advisor

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...

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

Avatar

Level 2

As workaround I have added following rewrite rule in Apache:

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