Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

etc/map .html issue

arvind
Level 4
Level 4

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 :

 

arvind_0-1630427041552.png

 

Now, when we access http://localhost:4502/content/we-retail/language-masters/en/experience/arctic-surfing-in-lofoten.htm...

Links are properly resolved like below:

 

arvind_1-1630427123002.png

 

PROBLEM:

 

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

 

arvind_2-1630427207675.png

 

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

1) With .html:

arvind_0-1630428308899.png

 

2)Without .html

 

arvind_4-1630427385738.png

 

 

Regards,

AP

 

 

 

 

 

5 Replies
Singaiah_Chintalapudi
Community Advisor
Community Advisor

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
Level 4
Level 4

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

Hi @arvind 

 

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
Level 4
Level 4

@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:

 

arvind_0-1630478912626.png

 

 

arvind_1-1630478949475.png

 

 

Idea is to have same output for TEST 1 also.

 

Thank you in advance.

 

asutosh_jena
Community Advisor
Community Advisor

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!