Using mod_rewrite like this:
RewriteBase /
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]
I can delete last slash in links like example.com/foo/ But wat if i want to delete this last slash in example.com/ the rules used before dont work. The same in this example: If i want to delete 2 slashes
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
it works fine if link is somthing like example.com/foo//bar But if the link is example.com//foo/bar the rule does not work.