Question

Je sais comment le faire avec PHP, comment remplacer plusieurs barres obliques de l'URL à une seule, par exemple:

http://example.com/uri1////////uri2/uri4

remplacer à:

http://example.com/uri1/uri2/uri4

etc. Comment y faire avec HTACCESS?

Était-ce utile?

La solution

Placez ce code dans votre DOCUMENT_ROOT/.htaccess dossier:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s[^?]*//
RewriteRule ^.*$ /$0 [R=301,L,NE]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top