N
N
Nikita Zelikov2022-04-20 14:30:41
htaccess
Nikita Zelikov, 2022-04-20 14:30:41

Glue double slashes and issue a 301 redirect, why does it throw out slugs?

Good day, I ran into the issue of gluing duplicates.
I have a link like https://test.ru/rar////rur/rump , where everything is slugs and you need to remove double slashes.
I came across this solution:

#убираем лишние слеши
    RewriteCond %{REQUEST_URI} ^(.*?)\/{2,}(.*?)$
    RewriteRule . %1/%2 [L,R=301]
    RewriteCond %{THE_REQUEST} //
    RewriteRule .* /$0 [R=301,L]

But it forwards back to the main one, can I glue the slashes through htazzes and return 301?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-04-20
@gzmone

RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]

This rule must be placed at the beginning of the file so that it works before the rest of the rules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question