Basically that, I have example.com/ but if I visit example.com// or with more slashes I would like to remove the extra ones and just leave one of them.
I found this but it's not working, I added on the .htaccess file.
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
RewriteRule (.*) %1/%2 [R=301,L]
</IfModule>
Keep in mind I used the homepage as an example, but it can happen on any page, adding extra slashes doesn't break the page but I need to be able to remove them so the user only sees one / at the end.