title: htaccess https redirect only on specific Zend Frameworks controller/actions
body: <p>I'm new to this community, but I've found it really useful time to time.</p>
  
  <p>I've searched for the answer a lot, but I didn't find anything like I need. I've tried to solve it on my own, but I still get errors, so I hope to find someone that can show me the right way... :-)</p>
  
  <p>I've got a "classic" ZF website, with many controller/action urls that are redirect to index.php with a .htaccess file.</p>
  
  <p>Now, what I need, is to redirect a couple of controller to https ssl connection excluding some actions of both controllers.</p>
  
  <p>The way I was trying to do it is:</p>
  
  <pre><code>
  Options +FollowSymLinks
  
  RewriteEngine on
  RewriteBase /
  
  RewriteCond %{HTTP_HOST} ^mydomain\.tld [NC]
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  
  RewriteCond %{HTTPS} on
  RewriteCond $1 ^!((member|shop)/(?!(index|login))(.*))
  RewriteRule ^(.*) http://%{HTTP_HOST}/$1 [L,R=301]
  
  RewriteCond %{HTTPS} off
  RewriteCond $1 ^((member|shop)/(?!(index|login))(.*))
  RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [L,R=301]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule !\.(js|ico|gif|jpg|png|css|swf|pdf|txt)$ index.php
  </code></pre>
  
  <p>It seems to work when I go to /member controller
  But then, when I go to another controller, for example /index or /about it does not redirect to the http connection (port 80), and if I try to change a little the rewrite condition regex it sometimes does a redirect loop and the browser gives me a notice blocking the connection to the site.</p>
  
  <p>Is there anyone that could show me the right synthax to use in my rewrite conditions to allow both the controllers (excluding the given actions) under an https connection and going back to a standard http connection when changing controller?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Alessandro</p>