After sling mappings config to remove .html, redirection 301 of trailing slash persist
AEM 6.5 withsamplecontent. A simple configuration of my /etc/map configuration to remove /content/we-retail & .html is causing one major issue The resolved page keeps on 301 redirecting the request from http://localhost:4503/us/en to http://localhost:4503/us/en/... When I try to forcefully remove the slash from the dispatcher web server, I am getting an infinite loop because of the AEM publisher keeps on 301 redirecting the request to http://localhost:4503/us/en/ (with the extra slash...).
Criteria:
- ✓Remove "/content/we-retail" prefix on URL. (is working)
- ✓Remove ".html" from Extension(is working)
- ✓Magic of the Sling Resolver should rewrite all urls to non .html and non /content/we-retail (is working)
- ❌No trailing slashes should exist (301 redirect is always happening) -- The problem really comes when I have the dispatcher connected to my publisher.
Can someone please take a look at my configuration below, and let me know what is wrong with it? (very basic config)
// 1. crx/de etc/map config
// 2. dispatcher virtualHost config
/// 1. crx/de etc/map config
{
"jcr:primaryType":"sling:Folder",
"localhost.4503":{
"jcr:primaryType":"sling:Mapping",
"sling:internalRedirect":[
"/content/we-retail"
],
"redirect":{
"jcr:primaryType":"sling:Mapping",
"sling:match":"(.*)",
"sling:internalRedirect":[
"/$1",
"/content/we-retail/$1.html"
]
},
"reverse_no_html":{
"jcr:primaryType":"sling:Mapping",
"sling:match":"$1",
"sling:internalRedirect":[
"/content/we-retail/(.*).html"
]
}
}
}
/// 2. dispatcher virtualHost config
<VirtualHost *:80>
ServerName weretail.com
ServerAlias www.weretail.com
DocumentRoot "${path}/we-retail"
<Directory "${path}/aem_sites">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
</Directory>
</VirtualHost>
Also can someone please explain what on earth is happening behind the scenes with all the AEM server-side redirects when sling mappings are configured. There's no documentation anywhere that talks about this.