Answer the question
In order to leave comments, you need to log in
Redirect // and more, to / inside %{request_uri} why doesn't it work?
Seemingly simple task. if the url has // or [/]{2,} and the like shortened to /
Accordingly, I write
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)[/]{2,}(.*)$
RewriteRule . %1/%2 [R=301,L]
do this
test.ru//path1/ - didn't work?!!
test.ru//path1// - worked
test.ru//path1//path2// - didn't work again!
it would be logical to assume that he simply does not see // at the beginning of the line, but still not, if the redirect
test.ru//path1// he goes to /test.ru/path1/ as it should be The
redirect refuses to work
can anyone come across?
Answer the question
In order to leave comments, you need to log in
strange, but the problem was solved quite easily, for some reason the square brackets were not processed validly, removing them all worked, also removed 301
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
# если повтоярется // более двух раз
RewriteRule . %1/%2 [R,L]
# исключить все слешы, поставить 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question