# Редирект на страницу без повторяющихся /. RewriteCond %{THE_REQUEST} // RewriteRule .* /$0 [R=301,L] 

THE_REQUEST used instead of REQUEST_URI , because otherwise, the redirect from site///page.htm l to site/page.html will not work, because REQUEST_URI contains part of the address after the last slash.

The problem is that THE_REQUEST contains GET request parameters. In the case of a request: site/page.html?// error ERR_TOO_MANY_REDIRECTS .

Question: how to implement a redirect to the page without repeating slashes, but not to check slashes in the GET request parameter after ? so that ERR_TOO_MANY_REDIRECTS error does not occur?

    1 answer 1

     RewriteCond %{THE_REQUEST} (^[^?]*) RewriteCond %1 // RewriteRule .* /$0 [R=301,L] 

    In short, trim the full request before? and then in this cropped part I am looking //. It seems to work. I do not know why such a thing is not used on other sites.