I am creating a modular CMS using the codeigniter framework, the main asset directory is:
/public/assets/[admin|public]/[css|images|js]
my current htaccess routes everything except requests starting with ‘public’ to the index.php file.
The new module system allows each module to have its own assets which would be located at
application/modules/*SOME_MODULE*/assets/[admin|public]/[css|images|js]
my question is, is it possible to create a rule to stop anything from a modules asset directory being routed to index.php?
My Current .httacces is:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|public/*)
RewriteRule ^(.*)$ /CI-Playground/index.php/$1 [L]
Assuming your URLs would be the full path to the modules’ various assets directories, you could easily exclude them from being rewritten:
You might like to cut out the
application/modulespart to make your request path shorter and your directory structure less exposed, which you could do like this:I see that you have another
.htaccessin your application directory though, which you’ll need to check for anything that might prevent outside requests from reaching the modules’ files.