We can different approaches to get a polished URL
1. Create rewrite rules in web server level so that any requests resolves to full content path on to AEM publisher
RewriteRule ^/$ /content/org/test/en.html [PT]
RewriteCond %{REQUEST_URI} ^/test$
RewriteRule ^/test$ /content/org/test/en.html [PT,L]
RewriteCond %{REQUEST_URI} ^/test/$
RewriteRule ^/test/$ /content/org/test/en.html [PT,L]
RewriteCond %{REQUEST_URI} ^/test/(.+)\.html$
RewriteRule ^/test/(.*)/$ /content/org/test/en/$1.html [PT,L]
RewriteCond %{REQUEST_URI} !^/test/(.+)\.html$
RewriteCond %{REQUEST_URI} ^/test/(.+)/$
RewriteRule ^/test/(.*)/$ /content/org/test/en/$1.html [PT,L]
RewriteCond %{REQUEST_URI} !^/test/(.+)\.html$
RewriteCond %{REQUEST_URI} !^/test/(.+)/$
RewriteCond %{REQUEST_URI} ^/test/(.+)$
RewriteRule ^/test/(.*)$ /content/bt/test/en/$1.html [PT,L]
The above rules will ensure all types of request, no HTML, trailing slash, with HTML are served.
2. Create forward and reverse sling mappings
Forward
{
}
Reverse
{
}