Answer the question
In order to leave comments, you need to log in
How to remove slashes finally correctly without Google and experiments?
What we have:
DirectorySlash off
RewriteEngine on
RewriteCond %{HTTPS}_%{HTTP_HOST} ^(?|off_(?:www\.)?(.*)|on_www\.(.*)) [NC]
RewriteRule .* https://%1/$0 [R=301,L]
RewriteRule (.*)/$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Answer the question
In order to leave comments, you need to log in
already got tired of writing that RewriteCond %{HTTPS}_%{HTTP_HOST} ^(?|off_(?:www\.)?(.*)|on_www\.(.*)) [NC is not necessary and Yandex perfectly understands the sequence of redirects . DOES NOT AFFECT SEO!
RewriteCond %{THE_REQUEST} //
# Проверяем, повторяется ли слеш (//) более двух раз.
RewriteCond %{QUERY_STRING} !http(s|)://
# Убедимся что это не урл в GET
RewriteRule .* /$0 [R=301,L]
# Исключаем все лишние слеши.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question