RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^(system|vendor|templates)/$ - [R=404]
RewriteRule ^(system|vendor|templates)/.*/$ - [R=404]
RewriteRule ^(system|vendor|templates)/.*\.(php|dat|tpl|scss|gitkeep|inc)$ - [R=404]