0

I have around 6-7 DOMAINS hosted on linode server where apache is a webserver. One domain is ssl configured and other runs on http only.

Suppose https://www.example.com is ssl configured . others are

http://www.example1.com 
http://www.example2.com
http://www.example3.com       
http://www.example4.com    

What would be the dynamic rule if someone put https://www.example1.com or others get redirect to http://www.example1.com and so on

like in virtalhost something like

  <If "%{HTTP_HOST} != 'example.com'">
     Redirect permanent / http://%{HTTP_HOST}/
 </If>

above written hack doesn't work . any help?

Anil Sharma
  • 121
  • 1
  • 6
  • If you still want to try doing this with rewrite, you should have a look at http://serverfault.com/questions/214512/everything-you-ever-wanted-to-know-about-mod-rewrite-rules-but-were-afraid-to-ask - but you will still get a certificate mismatch warning for all the sites except example.org. – Jenny D Feb 02 '15 at 12:58

1 Answers1

0

That is simply not workable because Apache can't serve (at least without a lot of tricks), different certificate for different domains. So in reality, you will not get HTTPS requests on the other non-HTTPS domains because the user will be presented with a warning that the certificate is invalid - and that is, only if you configure Apache to even respond to those requests.

You should just configure Apache to not even respond to HTTPS requests to the non-HTTPS domains.

ETL
  • 6,443
  • 1
  • 26
  • 47