Having trouble with proper regex for RewriteCond
RewriteCond %{REQUEST_URI} !^/foo/
Works as expected, that is, does not apply following rewrite to all URLs that start with /foo/.
RewriteCond %{REQUEST_URI} !^/foo/bar/
On the other hand does not work as I expect. URLs that begin with /foo/bar/ are still being rewrited.
How do I enter proper regex for excluding subdirectories?