Answer the question
In order to leave comments, you need to log in
How to remove slash at the end of htaccess url?
php_flag display_errors Off
RewriteEngine On
RewriteCond %{HTTP_HOST} !^tent-chehol.com$ [NC]
RewriteRule ^(.*)$ https://tent-chehol.com/$1 [R=301,L]
RewriteRule ^sitemap. xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteBase /
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index. php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css )
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
# Redirect to gzip files
AddEncoding gzip .gz
ForceType text/javascript
Header set Content-Encoding: gzip
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*) \.js$ $1\.js.gz [L]
ForceType text/javascript
ForceType text/css
Header set Content-Encoding: gzip
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept- Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)\.css$ $1\.css.gz [L]
ForceType text/css
Order Allow,Deny
Deny from all
Answer the question
In order to leave comments, you need to log in
it does not need to be removed, syntactically it should be there, except if it is not a file.
############################################################################
#### Убираем слеши в конце URL для статических файлов (содержит точку) ####
############################################################################
RewriteCond %{REQUEST_URI} \..+$
# Если файл содержит точку.
RewriteCond %{REQUEST_FILENAME} !-d
# И это не директория.
RewriteCond %{REQUEST_FILENAME} -f
# Является файлом.
RewriteCond %{REQUEST_URI} ^(.+)/$
# И в конце URL есть слеш.
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Исключить слеш.
############################################################################
#### Добавляем слеш(/), если его нет, и это не файл. ####
############################################################################
RewriteCond %{REQUEST_URI} !(.*)/$
# Если слеша в конце нет.
RewriteCond %{REQUEST_FILENAME} !-f
# Не является файлом.
RewriteCond %{REQUEST_URI} !\..+$
# В URL нет точки (файл).
RewriteCond %{REQUEST_URI} ^(.+)$
# В URL есть хоть один символы
RewriteRule ^(.*)$ $1/ [L,R=301]
# Добавляем слеш в конце.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question