title: How can I conditionally redirect to https using mod_rewrite?
body: <p>I would like to redirect to https using mod_rewrite only if certain conditions are met:</p>
  
  <p>If the URL does NOT contain the word 'administrator'
  AND the URL DOES contain the string 'xyz' (in any part of the URL, including the querystring)</p>
  
  <p>This does not seem to work:</p>
  
  <pre><code>RewriteCond %{REQUEST_URI} xyz [NC,OR]
  RewriteCond %{QUERY_STRING} xyz [NC]
  RewriteCond %{REQUEST_URI} !administrator [NC]
  ReWriteCond %{HTTPS} != on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R,L]
  </code></pre>