title: apache - mod_rewrite - redirect some paths to https others to http
body: <p>My company wants our site to force an http protocol for most of the site except for three sections 'user', 'shop', and 'cart'. I used the online .htaccess tester at <a href="http://htaccess.madewithlove.be/" rel="nofollow">http://htaccess.madewithlove.be/</a> to build my file first, and it appeared to be correct there. However, when I actually implemented it I had a problem. If I go to https for any of the regular pages it works and I'm redirected to the http version just fine. However if I go to '/shop', '/cart', or '/user' no matter if it's with http or https i just get redirected to the home page with http. Here's the .htaccess file:</p>
  
  <pre><code>  RewriteEngion on
    # Force HTTPS for /shop
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} /shop
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
    # Force HTTPS for /cart
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} /cart
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
    # Force HTTPS for /user
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} /user
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
    # Force HTTP for all others
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !/cart [NC]
    RewriteCond %{REQUEST_URI} !/shop [NC]
    RewriteCond %{REQUEST_URI} !/user [NC]
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
  
    # Pass all requests not referring directly to files in the filesystem to
    # index.php. Clean URLs are handled in drupal_environment_initialize().
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^ index.php [L]
  </code></pre>