.htaccess redirect to https except admin url
<p>I would like to redirect all frontend requests to secured site https and all admin / backend urls should remain unsecured http.
In addition, I use Cloudflare CDN.</p>

<p>My rewrite rules do not work, all queries go to https.</p>

<pre><code>RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{REQUEST_URI} !admin
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
</code></pre>

<p>Please help me.</p>