Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Handling Extensionless URLs in AEM

Avatar

Level 4

Hi,

In my case I want end user hitting <hotsname>/content/bootstrap-creative/language-masters/en/products/shoes to be served content from /content/bootstrap-creative/language-masters/en/products/shoes.html.

If user hits with .html extension then also user should be served.

I have thought of a solution involving apache webserver(for rewrite rules) and /etc/map of aem. In apache rewrite I will trip of .html from request if present and forward that to aem. In /etc/map of AEM, whatever request is coming I want to append .html at the end so that resource resolution works.

Note : User hitting <hotsname>/content/bootstrap-creative/language-masters/en/products/shoes should always see <hotsname>/content/bootstrap-creative/language-masters/en/products/shoes in the address bar and never should it change to .html extention.

Below Rule is what I have written in apache and it successfully strips .html from URL :

RewriteCond %{REQUEST_URI} !/$

RewriteRule ^/(.*).html$ $1 [R,QSA]

But I am unable to configure /etc/map inorder to append .html to incoming request so as to serve correct connect. Need help in writing /etc/map's "match" and "internalRedirect" property for this use case.

Regards,

Samir

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

There's an entire guild that has been written for this case. Click here to check it out, https://medium.com/tech-learnings/how-to-implement-extension-less-urls-in-aem-a3136c71b232

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

There's an entire guild that has been written for this case. Click here to check it out, https://medium.com/tech-learnings/how-to-implement-extension-less-urls-in-aem-a3136c71b232