etc/map .html issue | Community
Skip to main content
Level 5
August 31, 2021

etc/map .html issue

  • August 31, 2021
  • 2 replies
  • 1727 views

Hi All,

 

Etc/map rules only works when we add .html at the end of each url. Without .html, It does not map to appropriate url.

 

Below is etc/map :

 

 

Now, when we access http://localhost:4502/content/we-retail/language-masters/en/experience/arctic-surfing-in-lofoten.html?wcmmode=disabled

Links are properly resolved like below:

 

 

PROBLEM:

 

When we remove .html from HTML files, It does not map to proper url as below:

 

 

However,Through resource resolver It resolves in both the cases:

1) With .html:

 

2)Without .html

 

 

 

Regards,

AP

 

 

 

 

 

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

2 replies

Singaiah_Chintalapudi
Level 7
August 31, 2021

Your screenshots are not clear. You'll need to append .html at the dispatcher level and send them over to AEM and AEM is responsible to remove the .html for outbound urls. Are you using the links without .html extensions?

arvind-1Author
Level 5
August 31, 2021

Hello @singaiah_chintalapudi ,

 

Thank you for reply.

 

Now screen shots are clear.

 

We need to remove .html . Dispatcher rules are correct and working fine with or without html extension.

 

Problem is when we render any AEM page, and we do not add .html for links in sightly HTML, etc/map rules above does not resolve to correct url..

 

 

 

Asutosh_Jena_
Community Advisor
Community Advisor
September 1, 2021

Hi @arvind-1 

 

Please try with below.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Mapping"
sling:internalRedirect="/content/we-retail/language-masters/en/(.*).html"
sling:match="www.domain.com/$1"/>
arvind-1Author
Level 5
September 1, 2021

@asutosh_jena_  Thank you for your response.

 

Problem is not when we have .html in the URL.

 

We need to shorten URL when there is no .html in AEM url.e.g.

 

In HTML,

we have below lines:

<a href="/content/we-retail/language-masters/en/experience" >TEST 1</a></br>
<a href="/content/we-retail/language-masters/en/experience.html" >TEST 2</a>

 

and ETC MAP Rules as below:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/we-retail/language-masters/en/(.*).html,/content/we-retail/language-masters/en(.*)]"
sling:match="$1"/>

 

Problem is : 

 

It does not resolve URL without .html extension as below:

 

 

 

 

 

Idea is to have same output for TEST 1 also.

 

Thank you in advance.

 

Asutosh_Jena_
Community Advisor
Community Advisor
September 1, 2021

As per my understanding here, publish should never receive any request without .html. All request to publish should have .html extension and that should be handled in dispatcher. I believe enduser facing URL here is without any extension which is already taken care by etc/maps.

 

So the flow will be:

  1. etc/map will shorten the URL and remove the .html from URL
  2. dispatcher will serve the content to end user.
  3. any request coming from dispatcher to publish will have the full path with .html extension.
  4. publish will again serve the content with short URL by removing the .html extension.

This is how the cycle will continue. 

 

Thanks!