title: Apache: Multiple virtual host subdomain for the same server
body: <p>I would like to redirect all my apps to their urls:<br />
  for example:<br />
  <a href="https://gitlab.example.com" rel="nofollow noreferrer">https://gitlab.example.com</a> -&gt; to gitlab<br />
  <a href="https://sonarqube.example.com" rel="nofollow noreferrer">https://sonarqube.example.com</a> -&gt; to sonarqube</p>
  <p>Here is my actual config:</p>
  <pre><code>&lt;IfModule mod_ssl.c&gt;
  &lt;VirtualHost monitoring.example.com:443&gt;
      ServerName monitoring.example.com
  
      # Monitoring
      ProxyPass / http://localhost:9089/
      ProxyPassReverse / http://localhost:9089/
  
  SSLEngine on
  SSLCertificateFile      /etc/letsencrypt/live/example.com/fullchain.pem
  SSLCertificateKeyFile   /etc/letsencrypt/live/example.com/privkey.pem
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost sonarqube.example.com:443&gt;
      ServerName sonarqube.example.com
  
      # Sonarqube
      ProxyPass / http://localhost:90000/
      ProxyPassReverse / http://localhost:90000/
  
  SSLEngine on
  SSLCertificateFile      /etc/letsencrypt/live/example.com/fullchain.pem
  SSLCertificateKeyFile   /etc/letsencrypt/live/example.com/privkey.pem
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:443&gt;
          ServerName example.com
  
          DocumentRoot /var/www/html
  
          ErrorLog /var/log/apache2/error.log
  
          # Possible values include: debug, info, notice, warn, error, crit,
          # alert, emerg.
          LogLevel warn
  
          CustomLog /var/log/apache2/access.log combined
  
          SSLEngine on
          SSLCertificateFile      /etc/letsencrypt/live/example.com/fullchain.pem
          SSLCertificateKeyFile   /etc/letsencrypt/live/example.com/privkey.pem
  &lt;/VirtualHost&gt;
  &lt;/IfModule&gt;
  </code></pre>
  <p>But there problem is that if I go to another subdomain (ex: test.example.com) it will redirect to my monitoring.example.com whereas it should only redirect to DocumentRoot...</p>
  <p>How can I segment my virtualHost based on subdomain?</p>