title: htaccess redirect to HTTPS except a few urls
body: <p>I am new to the htaccess redirect stuff but want to do smth special - and I dont know whats the recommend way and dont know if this is still possible or not.</p>
  
  <p>I have this in my .htaccess file:</p>
  
  <pre><code>RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  
  <p>Now every URL is redirected to the HTTPS version - this is fine and necessery. But now there are a few exceptions.</p>
  
  <p>For example these urls HAS to be HTTP instead of HTTPS:</p>
  
  <pre><code>http://www.mywebsite.com/another/url/which/has/to/be/http
  http://www.mywebsite.com/and_again?var=a
  </code></pre>
  
  <p>Is it possible to solve this with the htaccess and when its possible maybe you can send me a reference link or describe how to do this.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I now have this code:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  RewriteCond %{HTTPS} off 
  RewriteCond %{THE_REQUEST} !\s/+(/commerce_paypal/*)\s [NC] 
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  
  <p>The goal is that <strong>every</strong> (!) url gets redirected to HTTPS except ANY url which has commerce_paypal at the beginning.</p>
  
  <p>For example:</p>
  
  <pre><code>mydomain.com/commerce_paypal  &lt;- http
  mydomain.com/commerce_paypal/smth/else &lt;- http
  mydomain.com/what/ever &lt;- https
  </code></pre>