0

I have an Apache testserver with a SSL site (Port 443, www.example1.net) and a normal non-SSL site (Port 80, www.example2.net). DNS points to the serverip (192.168.1.1), everything works.

However, is there a solution for the following problem: When I enter https://www.example2.net (SSL requesting the non-SSL site, but on the same serverip) in the browser, it shows me the CN error with the certificate (of course) and later on the example1.net site.

Is the a way to let Apache answer ONLY to what I define via ServerName or ServerAlias in the vhost config? Or can this problem fixed otherwise? I do not want apache to respond to SSL requesting the non-SSL Site.

Thanks!

1
  • Unless you have www.example2.net configured to use port 443 as well, opening https://www.example2.net is trying to open example1 since it's the only one using 443. But apache would give an error to the browser because the certificate's registered domain doesn't match the domain that is accessing the VHost.
    – Dan
    Jul 3, 2015 at 11:58

1 Answer 1

0

One way to solve this would be by using redirects in your .htaccess file. Here's an example for your example2.net .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,

However if you do not have an SSL certificate on example2.net you will still get the browser warning as it is generated before the .htaccess file is read.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .