Answer the question
In order to leave comments, you need to log in
How to correctly write a rule in .htaccess?
This rule almost works as it should, but when redirecting, it adds extra paths to the URL (/home/bitrix/www/) 85.236.13.62/home/bitrix/www/internet-magazin/fold... , which causes a 404 error how to fix it so that these paths are not substituted (/home/bitrix/www/)
#### Добавляем слеш(/), если его нет, и это не файл.
RewriteCond %{REQUEST_URI} !(.*)/$
# Если слеша в конце нет.
RewriteCond %{REQUEST_FILENAME} !-f
# Не является файлом.
RewriteCond %{REQUEST_URI} !\..+$
# В URL нет точки (файл).
RewriteRule ^(.*)$ $1/ [L,R=301]
# Добавляем слеш в конце.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question