htaccess 301 redirect everything except /admin I have been scratching my head for almost half an hour already because of this. I don't know what I am doing wrong, might just be under my nose, but i just cant see it. Here's what I have on my .htaccess

  RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  RewriteCond %{REQUEST_URI} !^/admin [NC]
  RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]


When I access example.com/admin, i am still redirected to newsite.com/admin.Can anyone please advise? Thanks!
It depends on RewriteBase /.
I checked your code with this online tool and it was working fine.
Toggling comment for rewritebase line will help but other rules might get affected. Instead, modify your condition and remove the slash. It should work.

RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^admin [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]