On another RewriteCond after your first, which will prevent the RewriteRule from matching. I sometimes filter specific file extensions for static content files using the following rule:
RewriteCond $1 !\.(js|ico|gif|jpg|png|css|html|swf|mp3|wav|txt)$
If you want to do this based on a directory, then you will need something like this:
RewriteCond $1 !^(css|js|img)/
Put one of them in front of the existing one RewriteCond, and you should be good to go.
source
share