title: How to create a virtual host that works with both http and https?
body: <p>My config is:</p>
  
  <pre><code>Listen 443 http
  NameVirtualHost *:80
  NameVirtualHost *:443
  ServerName *:80
  
  &lt;VirtualHost *:80&gt; 
    [some non-ssl stuff]
    ServerName account.example.com
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:443&gt; 
    [some non-ssl stuff(directory, docroot)] 
    ServerName account.example.com
    SSLEngine on
    SSLCertificateFile /Users/myusername/certs/server.crt
    SSLCertificateKeyFile /Users/myusername/certs/server.key
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>So I can't access the http version of my site, but ssl version is working correctly. I want to use both vhosts, http(80) and https(443) to rewrite http to https URL via mod_rewrite.</p>
  
  <pre><code>uname -a
  Linux 3.4.62-53.42.amzn1.x86_64 GNU/Linux
  
  httpd -v
  Server version: Apache/2.2.25 (Unix)
  </code></pre>
  
  <p>Please help to understand what I'm doing wrong.</p>