title: Apache htaccess: Unable to use RewriteCond HTTPS and HTTP_USER_AGENT together
body: <p>I'm trying to rewrite a URL to a specific domain based on the user agent. But if i change the domain to <strong>https</strong> i get a 500 Internal Server Error.</p>
  
  <p>This htaccess rewrite rule is working as expected:</p>
  
  <pre><code>RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Facebot)
  RewriteRule ^(.*)$ http://example.com/?url=%{REQUEST_URI} [P]
  </code></pre>
  
  <p>This example throws a 500 Internal Server Error:</p>
  
  <pre><code>RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Facebot)
  RewriteRule ^(.*)$ https://example.com/?url=%{REQUEST_URI} [P]
  </code></pre>
  
  <p>I tried the following but the user agent condition will not work:</p>
  
  <pre><code>RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Facebot)
  RewriteRule ^(.*)$ https://example.com/?url=%{REQUEST_URI} [P]
  </code></pre>
  
  <p>What am i doing wrong? How can i solve my issue?</p>