title: How to redirect all URLs except one path and all its subpaths without mod_rewrite?
body: <p>I have Apache 2.4 in front of Tomcat 7 (altough I think just the former matters here).
  I need to redirect all the requests on a domain to the HTTPS port, but not those going to a specific folder:</p>
  
  <pre><code>(1) http://www.example.com/ -&gt; https://www.example.com/
  (2) http://www.example.com/products -&gt; https://www.example.com/products
  (3) http://www.example.com/... -&gt; https://www.example.com/...
  </code></pre>
  
  <p>while</p>
  
  <pre><code>(4) http://www.example.com/services should pass straight 
  (5) http://www.example.com/services/main should pass straight
  (6) http://www.example.com/services/main/list?params should pass straight
  </code></pre>
  
  <p>How can I accomplish this without using <code>mod_rewrite</code> (as I found was told in other questions)?</p>
  
  <p>I saw in the docs that redirects are handled with the <a href="http://httpd.apache.org/docs/current/mod/mod_alias.html#redirect" rel="nofollow noreferrer">Redirect</a> and <a href="http://httpd.apache.org/docs/current/mod/mod_alias.html#redirectmatch" rel="nofollow noreferrer">RedirectMatch</a> directives.</p>
  
  <p>So I can handle 1,2,3 with:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ...
      ServerName www.example.com
      Redirect / https://www.example.com
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>but I can't write a regular expression to handle the other three. I found in <a href="https://stackoverflow.com/a/406408/3127111">this answer</a> that I can use negative lookarounds, but a regex like <code>/(?!services).*</code> will only match 4 (at least according to <a href="http://regexpal.com/" rel="nofollow noreferrer">Regex Tester on </a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've specified that this can be accomplished without <code>mod_rewrite</code>.</p>