0

I have several domains under the same server, but my https certificated only works for one of them.

  1. I need to force https for: mydomain1.com
  2. All other domains (mydomain2.com, mydomain3.com ...) must use http.

I know it must be a simple rule, but I wasn't able to figure it out.

0

1 Answer 1

2

Just use virtual hosts : http://httpd.apache.org/docs/current/vhosts/name-based.html

But they require to be specified inside the server configuration (can't do it inside .htaccess)

<VirtualHost *:443>
    ServerName mydomain1.com
    DocumentRoot /www/mydomain1
    SSLEngine on
    SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt 
    SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key
</VirtualHost>

<VirtualHost *:80>
    ServerName mydomain2.com
    DocumentRoot /www/mydomain2
</VirtualHost>

<VirtualHost *:80>
    ServerName mydomain3.com
    DocumentRoot /www/mydomain3
</VirtualHost>
2
  • I don't have access to it. I was trying to find a workaround using htaccess, but it seems that I will have to request this to the server admin.
    – Acacio
    Feb 5, 2013 at 15:03
  • All theses options are security sensitive and so are limited to server config : httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslengine Context: server config, virtual host
    – Cerber
    Feb 5, 2013 at 15:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.