RewriteEngine On
# Remove trailing slashes
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)/+$ http://%{HTTP_HOST}/$1 [R=301,L]
# Hide some stuff the visitors don't need to see (default directories
# for parts of the framework)
RewriteRule ^(smarty|models|controllers)(/.*)$ /index.php?controller=404 [L]
# Redirect all requests for nonexistent files to dispatcher
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)(/*)(.*)$ /index.php?controller=$1&args=$3 [L]