javascript - Configure htaccess to directly access CSS and JS files but redirect all the other requests to index file -
this question exact duplicate of:
i developing system positively confused how supposed implement this. simplified file structure
-.htaccess --/public --/public/index.php --/project --/project/template1/css --/project/template2/js --/project/all-other-files-and-folders-used
my system redirects requests index.php, loads files in project folder other work want htaccess recognize css,img , js files in project folders , allow direct access them.
this .htaccess file have now
rewriteengine on rewriterule ^((?!public/).*)$ public/$1 [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?cmd=$1 [pt,l]
is possible? in advance
you can use:
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^((?!(?:public|project)/).+)$ public/index.php?cmd=$1 [qsa,nc,l]