I have following htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [QSA,NC,L]
and all is working fine. But now I need to remove trailing slash from url. Which means that http://localhost:8888/folder_app/en/psssses/index/asd/
(notice the trailing slash) will redirect to http://localhost:8888/folder_app/en/psssses/index/asd
without trailing slash...
Many thanks for help
Asked
Active
Viewed 227 times
0

user3347718
- 15
- 3
1 Answers
1
You can use a new rule for this:
RewriteEngine On
RewriteBase /folder_app/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} /(.+?)/+[?\s]
RewriteRule ^(.+?)/$ $1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

anubhava
- 761,203
- 64
- 569
- 643
-
Thank you, this works but not as I expected. My app is in folder folder_app so url is `http://localhost:8888/folder_app` , and your code redirect to root `http://localhost:8888/`.. Do you know how to redirect to current folder? Thanks – user3347718 Sep 03 '14 at 19:48