Expand my Community achievements bar.

SOLVED

Dispatcher caching extra / in html page

Avatar

Level 3

Hi All,

 

Extra "/" is adding in the end of the page like : https://domainname/content/abc/dashboard.html/ and this is cached on dispatcher level because dispatcher is treating dashboard.html page as a directory.

 

On dispatcher side we can see this url used by some user "dashboard.html/content/dam/abc/us/project-folder/image/common/icon/favicon"

How can we restrict it, so that dispatcher will not treat this page as directory and "/" will not append in the url. Please suggest.

We are using AEM6.4 right now.

 

 

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sunily21159739

 

<IfModule disp_apache2.c>
   DirectorySlash Off
   SetHandler dispatcher-handler
</IfModule>

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @sunily21159739 

One way i can think of is to add a rewrite that will remove the trailing slash from your URL's . You can use the below snippet and add the same in the apache rewrites.

 

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_URI} (.*)/$

RewriteRule ^(.*)/$ $1 [L,R=301]

 

Remove R=301 if you don't want to show the redirect 

 

You can also test the same in the below url

https://technicalseo.com/tools/htaccess/

 

Hope it helps!

 

Avatar

Correct answer by
Community Advisor

Hi @sunily21159739

 

<IfModule disp_apache2.c>
   DirectorySlash Off
   SetHandler dispatcher-handler
</IfModule>