My application is quite large and it is split into areas and I would like to have a seperate public folder in each of these areas for images and scripts that are only needed within that specific area.
I am currently directing all traffic to my public folder with the following:
RewriteEngine On
RewriteBase /
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
And in the public folder I have the following .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+index\.php\?url=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Is it possible to allow requests to:
http://example.com/area/public/scripts/myscript.js
Change your root .htaccess to this:
RewriteEngine On
RewriteBase /
RewriteRule ^$ public/ [L]
RewriteRule ^((?!area/public/).*)$ public/$1 [L,NC]