title: mod_rewrite on substring in URL
body: <p>I'm forcing HTTPS on my site using mod_rewrite but I want to change this to HTTP for any URL with the substring <strong>com_bookmangement</strong> in the URL.</p>
  
  <p>So</p>
  
  <pre><code>http://www.example.com/index.php?option=com_content&amp;view=article&amp;id=85&amp;Itemid=140
  </code></pre>
  
  <p>will be directed to </p>
  
  <pre><code>https://www.example.com/index.php??option=com_content&amp;view=article&amp;id=85&amp;Itemid=140
  </code></pre>
  
  <p>BUT </p>
  
  <pre><code>https://www.example.com/index.php?option=com_bookmanagement&amp;controller=localbooks&amp;Itemid=216
  </code></pre>
  
  <p>will be directed to</p>
  
  <pre><code>http://www.example.com/index.php?option=com_bookmanagement&amp;controller=localbooks&amp;Itemid=216
  </code></pre>
  
  <p>I've tried this without success:</p>
  
  <pre><code>#rewrite everything apart from com_bookmanagement to HTTPS
  RewriteCond %{SERVER_PORT} !443
  RewriteCond %{REQUEST_URI} !com_bookmanagement=
  RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
  
  #rewrite vouchers views to http
  #RewriteCond %{server_port} 443
  RewriteCond %{REQUEST_URI} ^com_bookmanagement=
  RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L]
  </code></pre>
  
  <p>Any ideas?</p>