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?

È stato utile?

Soluzione

Posiziona questo codice nel tuo DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top