2016-02-29 4 views
0

Попытка добавить косые черты ко всем ссылкам. Например:Переадресация на trailng slash (htaccess)

http://testsite.com/products 

должен 301 redirect к:

http://testsite.com/products/ 

и т.д. Но как? Вот мой текущий .htaccess:

AddDefaultCharset utf-8 
Options -Indexes 

RewriteEngine On 
RewriteBase/
RewriteRule ^.htaccess$ - [F] 

RewriteCond %{REQUEST_URI} !\.(ico|css|js|txt)$ [NC] 
RewriteCond %{REQUEST_FILENAME} !^/admin 
RewriteCond %{REQUEST_FILENAME} !^/migrate 
RewriteCond %{REQUEST_FILENAME} !^/install 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ /index.php [L] 

ответ

0
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*[^/])$ /$1/ [L,R=301] 
+0

бы не 'RewriteRule/$/$ 0/[L, R = 301]' хватает? – eggyal

+0

Можно попробовать, не уверен. –

+0

Привет, это работает, но теперь моя страница ошибки 404 не отображается – Pavel

Смежные вопросы