Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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.