<IfModule mod_rewrite.c>
    Options -MultiViews

    RewriteEngine On
    #RewriteBase /path/to/app

    RewriteCond %{REQUEST_URI} !\?
    RewriteCond %{REQUEST_URI} !\&
    RewriteCond %{REQUEST_URI} !\=
    RewriteCond %{REQUEST_URI} !\.
    RewriteCond %{REQUEST_URI} ^(.+)/$
    RewriteRule ^(.*)/$ %1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]

</IfModule>