Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Getting source of the page with double slash(//) at the end of the URL.

Avatar

Community Advisor

Dear Members,

I am facing one unique kind of issue with "//" at the end of the url.

When I hit https://dev-demo.edev.mysite.com:8080/personalcare/shop/shampoo/ it works perfectly fine but when I hit the sam url with double slash at the end https://dev-demo.edev.mysite.com:8080/personalcare/shop/shampoo// it gives source of webpage.

When I check the same it browser's Network tab it simply try to call "/" as document as in below image

Umesh_Thakur_0-1616751314529.png

then I try to further analyse the dispatcher log I see with correct url it was looking for regular path in cache but with wrong url(with double slash) it try to look some thing strange to me like

/content/mysite/www/us/en_us/personalcare/shop/shampoo.fold.html/.html

 

we already have remove slash rule on the dispatcher and it is working fine in some environment.

 

I am not able to find the root cause of it. if any one can please share some insight on it.

Thanks

Umesh Thakur

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

HI Umesh,

The root cause could be reverse mapping, which is adding .html after end /

You should check the reverse mapping rule as well.



Arun Patidar

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @Umesh_Thakur 

I see the request URL has "fold" as the selector but not sure where it is coming from.

Can you please try with the below rule and see if it resolves the issue.

 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/+$ $1 [R=301,L]

Thanks! 

Avatar

Community Advisor

Hi @asuthosh, thanks for your response.

We already have similar rule like

RewriteCond %{REQUEST_URI} !^/?(etc.clientlibs|resources|libs|content|libs|conf|apps|Locations|dispatcher|data|EstoreValidateFormsAuthentication) [NC]
RewriteCond %{REQUEST_URI} !\.(html|htm|xml)$
RewriteRule ^(.*[^/])$ $1/ [R=301,L]
 
and
RewriteRule ^(.+)/$ $1
 
but no luck.
 

Avatar

Correct answer by
Community Advisor

HI Umesh,

The root cause could be reverse mapping, which is adding .html after end /

You should check the reverse mapping rule as well.



Arun Patidar

Avatar

Community Advisor
Thank you very much Arun for the response, there was one dispatcher rewrite rule which was making the url like I posted in the question, I resolved the issue with another dispatcher rule to eliminate double slash from url. That worked for me.

Avatar

Community Advisor

You should be redirecting these requests (ending with //) to 404 page at the apache/dispatcher level. Any specific requirement that you want to allow these pages?

Avatar

Community Advisor
Thanks @singaiah, That was a bug in the rewrite rule so we corrected it.