Handling Extensionless URLs in AEM | Community
Skip to main content
__96
New Participant
July 3, 2017
Solved

Handling Extensionless URLs in AEM

  • July 3, 2017
  • 1 reply
  • 1676 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

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

 

1 reply

BrianKasingli
BrianKasingliAccepted solution
New Participant
July 17, 2023

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