title: Redirecting http to https for login controller only in CakePHP
body: <p>I've been trying to redirect http access to https in my CakePHP project. 
  It is easy to do so by modifying app/webroot/.htaccess.</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      # added for redirecting http to https
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
  
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>However, if I try to redirect only login controller to https, I cannot do it.  For example, </p>
  
  <pre><code>    RewriteCond %{HTTPS} off
      RewriteCond %{REQUEST_URI} ^/login/.*$
      RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
  </code></pre>
  
  <p>The RewriteCond above doesn't work, because still all connections are redirected to https.  I've been modifying the regular expression in the RewriteCond for last few hours with no success.</p>
  
  <p>I searched the web and Stack Overflow for similar problems, but I couldn't find for CakePHP.  Does anyone have some idea?</p>
  
  <p>I use CakePHP2.7.5, Apache2.2.27, CentOS6.7.  Cake is installed in DocumentRoot.  No special settings.  I restart Apache every time I modify .htaccess.</p>