0

Пробовал с помощью этого:

RewriteBase /
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [R=301,L]

Но, ничего не вышло. Подскажите в чем дело?

2 ответа 2

0

Попробуйте так:

RewriteEngine On
RewriteBase / 
Options +FollowSymLinks

RewriteCond %{REQUEST_URI} ^(.*?)\/{2,}(.*?)$
RewriteRule . %1/%2 [L,R=301]
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]
0

Мой конфиг

# redirect from site.com/index.php to site.com
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

# redirect from www.site.com to site site.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]

#remove double slashes
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /{2,}
RewriteRule ^(.*) /$1 [R=301,L]

# redirect from site.com/ to site site.com
RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} ![^\/]$
RewriteRule ^(.*)\/$ /$1 [R=301,L]

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.