Answer the question
In order to leave comments, you need to log in
How to remove slashes at the end of the URL and duplicate slashes if there are any in the middle through .htaccess?
Hello, I can not figure out how to remove the slashes at the end of the url.
The site works through the front controller, all requests are sent to index.php
Now .htaccess looks like this:
AddDefaultCharset utf-8
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php
Answer the question
In order to leave comments, you need to log in
AddDefaultCharset utf-8
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[^?]+//
RewriteRule ^(.*)$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question