title: www.api.domain.com leads to one page and api.domain.com leads to another. www.domain.com works but domain.com doesn't. What gives?
body: <p>I have the following Apache virtual hosts config file called 000-default.conf</p>
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName mydomain.com
      DocumentRoot /var/www/mydomain.com
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  
      RewriteEngine on
      RewriteCond %{SERVER_NAME} =mydomain.com
      RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
      ServerName api.mydomain.com
      ProxyPreserveHost On
      ProxyPass / http://xxx.xx.xx.xx:3000/
      ProxyPassReverse / http://xxx.xx.xx.xx:3000/
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  <p>I am facing the 2 following issues and I'm not sure if the problem is on Apache's side or on the DNS's side:</p>
  <ol>
  <li>When I visit <a href="http://www.mydomain.com" rel="nofollow noreferrer">www.mydomain.com</a> , I see the page that I am supposed to
  be seeing but if I try typing just domain.com in the search bar, I
  get an error - This site can’t provide a secure connection</li>
  <li>When I visit api.mydomain.com , I see the correct page which I'm
  supposed to be seeing BUT when I try <a href="http://www.api.mydomain.com" rel="nofollow noreferrer">www.api.mydomain.com</a> , I get
  the page that is supposed to be on <a href="http://www.mydomain.com" rel="nofollow noreferrer">www.mydomain.com</a> instead.</li>
  </ol>
  <p>Can anyone shine some light on whether this is a result of bad Apache configuration or I need to do something on the DNS?</p>