Place this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]
Question
I know how to do it with PHP, how to replace multiple slashes from URL to only one, for example:
http://example.com/uri1////////uri2/uri4
replace to:
http://example.com/uri1/uri2/uri4
etc. How do to it with htaccess?
Solution
Place this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]