-1

I have several sites on my server. For example: domain1.com and domain2.com. If user requests a not existing sub-domain (For example: a.domain2.com) he will be redirected to domain1.com. I want to show 404 page if this situation happens. For http traffic I use such config for vhost:

<VirtualHost _default_:80>
    Redirect 404 /
    ErrorDocument 404 "Page Not Found"
</VirtualHost>

I also have https versions of my sites. I have tried to do something like this:

<VirtualHost _default_:433>
    Redirect 404 /
    ErrorDocument 404 "Page Not Found"
</VirtualHost>

But my https sites stop opening. How to achive http behavior for https?

3
  • What error do you get when trying HTTPS?
    – Dre
    Mar 23, 2016 at 0:34
  • Chrome says that your connection is not private. Mar 23, 2016 at 8:50
  • Rereading through your post, can you clarify: You have the several web sites working fine... but when you put this entry in your config file, all the HTTPS sites stop working. Is that correct?
    – Dre
    Mar 23, 2016 at 17:56

1 Answer 1

0

My guess right now is one of two things:

  • You do not have an SSL certificate specified for the HTTPS virtual host
  • Your certificate is for domain1.com, but is not a wild card certificate and/or does not have a Subject Alternative Name for a.domain1.com configured.

If you want HTTPS to work for a.domain1.com and b.domain1.com and whatever.domain1.com, your best option is to get a wildcard certificate for *.domain1.com

2
  • I have correctly configured named vhosts for my https versions of sites. But when I'm trying to add default vhost for *:443 apache starts ignoring my named vhosts. Crome start saying that your connection is not private and doesn't show anything but error page. I have tried to use "SSLEngine on" but than I should configure correct ssl certificates. I don't know what ssl certificate to use. I want common solution for many domains. Mar 23, 2016 at 8:59
  • Chrome will usually include in the error... something like "NET::ERR_CERT_COMMON_NAME_INVALID". Do you see anything like that? What does it say?
    – Dre
    Mar 23, 2016 at 17:41

You must log in to answer this question.

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