S
S
Sergey Gladyshev2018-03-23 16:23:59
htaccess
Sergey Gladyshev, 2018-03-23 16:23:59

Eliminate non-existent pages that have more than one slash in the URL at an arbitrary level of nesting of sections.?

Good afternoon.
i.e., for example, a redirect from catalogue/////kukhni/ to catalogue/kukhni/
/catalogue/////accessories/ => /catalogue/accessories/
/catalogue/accessories///// => / catalogue/accessories/
////catalogue/accessories/ => /catalogue/accessories/
this works when


RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{THE_REQUEST} ^[AZ]+\s//+(.*)\sHTTP/[0-9.]+$
RewriteRule .* https://% {HTTP_HOST}/%1 [R=301,L]

with more nesting (for example /catalogue/accessories/svet/lampa-mood//// ) the problem has not yet been solved

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-03-23
@Resident234

############################################################################
#### Убираем повторяющиеся слеши (/) в URL                              ####
############################################################################
RewriteCond %{THE_REQUEST} //
   # Проверяем, повторяется ли слеш (//) более двух раз.
RewriteRule .* /$0 [R=301,L]
   # Исключаем все лишние слеши.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question