<IfModule mod_rewrite.c>
    Options +MultiViews +FollowSymLinks
    
    DirectoryIndex index.php index.html
    RewriteEngine on

    RewriteRule modules/(.+)/controllers/(.+)\.php$ /index.php?/$1/$2 [L,R=301]
    RewriteRule controllers/(.+)\.php$ /index.php?/$1 [L,R=301]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>