title: Nginx redirect if not host and if not request uri
body: <p>Can anyone see why the following Nginx if statements doesn't work </p>
  
  <pre><code>if ($host != subdomain.mydomain.com) {
      set $test  A;
  }
  
  if ($request_uri != /.well-known/acme-challenge/(.*?)) {
    set $test  "${test}B";
  }
  
  if ($test = AB) {
    rewrite ^/(.*) https://www.anotherdomain/$1 permanent;
    break
  }
  </code></pre>
  
  <p>In English, if the host is not subdomain.mydomain.com and the request URI is not /.well-known/acme-challenge/* then I want it to redirect to another domain</p>