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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Umesh_Thakur
Community Advisor
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
Arun_Patidar
Correct answer by
Community Advisor
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.

View solution in original post

6 Replies
Asutosh_Jena_
Community Advisor
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! 

Umesh_Thakur
Community Advisor
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.
 
Arun_Patidar
Correct answer by
Community Advisor
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.

View solution in original post

Umesh_Thakur
Community Advisor
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.
Singaiah_Chintalapudi
Community Advisor
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?

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