Reputation: 11
My DocumentRoot is var/www/public
I've following .htaccess file (inside var/www/public):
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteRule ^(.*)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
When I enter for example http://localhost:8080/en/schedule/
it works fine - redirects to url without trailing slash (http://localhost:8080/en/schedule
)
But there are cases when it not works well:
http://localhost:8080/en/news/
redirects to http://localhost:8080/var/www/public/en/news
Upvotes: 0
Views: 83
Reputation: 11
Different behaviour for different links was caused by web browser cache.
New .htaccess:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)/$
RewriteRule ^(.*)/$ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Upvotes: 1