Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

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:
  2. All other domains (, ...) must use http.

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

share|improve this question

marked as duplicate by Lucas Kauffman, RolandoMySQLDBA, mgorven, mdpc, Ward Feb 6 '13 at 4:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

Just use virtual hosts :

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

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

<VirtualHost *:80>
    DocumentRoot /www/mydomain2

<VirtualHost *:80>
    DocumentRoot /www/mydomain3
share|improve this answer
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 '13 at 15:03
All theses options are security sensitive and so are limited to server config : Context: server config, virtual host – Cerber Feb 5 '13 at 15:09

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