I have a site www.example.com for which i purchased SSL cert and installed.

And it was working fine, I also have a subdomain with app.example.com which was not on SSL.

Both www.example.com and app.example.com are on same IP address.

At later we decided to put SSL only on app.exapmle.com and then i configured SSL with app.example.com and it worked fine,

Now the issue is that Google is indexing my site as https://www.example.com/ and when users hits the web , Invalid security warning is issued and when user allow security issue they are shown my app.example.com contents.

Note: I have my SSL configuration files in /etc/httpd/conf.d/ssl.conf

The contents of the ssl.conf are below.


NOTE: I tried solutions in .httaccess but none of those worked. Like redirecting 301 redirects etc

2 Answers 2


Since app.example.com and www.example.com are on the same IP adress, using https on either of the 2 will use the defined VirtualHost in your ssl.conf, since you did not specify a servername:

Line 84: #ServerName example.com:443

What you need is VirtualHost on port 443 redirects to http for a given servername

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

See: https://stackoverflow.com/questions/8371/how-do-you-redirect-https-to-http


You need to get a wildcard SSL certificate:


The * makes it wildcard and thus you can use it on www.example.com and app.example.com

  • I do not want to purchase a wildcard certificate. I want www.example.com on non HTTPS as this is my static contents.
    – Asghar
    Oct 24, 2013 at 9:22
  • please read the answer above by Ronald Swets, that is another option you have.
    – jjohnson
    Oct 28, 2013 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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