I have an apache server with one ip address. (on a debian server).
I have several virtualhosts for http and one virtualhost for https
one vhost, redirect traffic to the https vhost and this works fine, something like this
<VirtualHost *:80> ServerName mymainsite.com ServerAlias www.mymainsite.com ServerAlias myothersite.org ServerAlias www.myothersite.org RewriteEngine on RewriteRule ^(.*)$ https://www.mymainsite.com$1 [L,R=301] (...)
I have another vhost for https, like this
<VirtualHost *:443> ServerName www.mymainsite.com (...)
and this works fine, all non https is forwared to https, and that is super.. but then the problem.
some times people go to this url https://www.myothersite.org
and this is answered by the https vhost, and creates a "wrong certificate" error.
Question is: is there a way to prevent this, without using a 2nd ip address, or buying a multi url or wildcard SSL certificate?
edit: just remove some extra text