Virtualhost one https site, the rest http
- by RJP1
I have a linode server with Apache2 running a handful of sites with virtualhosting.
All sites work fine on port 80, but one site has a ssl certificate and also runs okay.
My problem is as follows:
The non-https sites, if visiting https://domain.com - show the contents of the only secure site...
Is there a way of disabling the *:443 match for these non-secure sites?
Thanks!
EDIT (more information):
Here's a typical config in sites-available for a normal insecure http site:
<VirtualHost *:80>
ServerName www.insecure.com
ServerAlias insecure.com
...
</VirtualHost>
The secure https site is as follows:
<VirtualHost *:80>
ServerName www.secure.com
Redirect permanent / https://secure.com/
</VirtualHost>
<VirtualHost *:80>
ServerName secure.com
RedirectMatch permanent ^/(.*) https://secure.com/$1
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLProtocol all
SSLCertificateChainFile ...
SSLCertificateFile ...
SSLCertificateKeyFile ...
SSLCACertificateFile ...
ServerName secure.com
ServerAlias secure.com
...
</VirtualHost>
So, visiting:
http:/insecure.com - works
http:/www.insecure.com - works
http:/secure.com - redirects to https:/secure.com - works
http:/www.secure.com - redirects to https:/secure.com - works
https:/insecure.com - shows https:/secure.com - WRONG!