Posiziona questo codice nel tuo DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]
Domanda
So come farlo con PHP, come sostituire più barre da URL a uno solo, ad esempio:
http://example.com/uri1////////uri2/uri4
sostituire a:
http://example.com/uri1/uri2/uri4
ecc. Come fare con Htaccess?
Soluzione
Posiziona questo codice nel tuo DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]