I have an SSL cert valid for the www. and . subdomains on a domain. That's up and working great. All traffic on http redirects to https, and all bare domain traffic redirects to the www. version. In short, everything ends up on https://www. So far so good.

However, I also have a .com. That currently has an apache level redirect (can't change DNS currently)

At the moment going to the https://www.***.com address shows that the certificate isn't valid, which is of course correct – it's only for www and . on .co.uk.


How do I get the https://www.***.com to redirect to https://www.***.co.uk without a valid SSL cert for the .com, and without changing the DNS?

Technical details

All domains point to same server. A vhost is set up for the ssl version and non ssl version, both with aliases for www and no www for the .co.uk and .com.

A rewrite rule like:

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

pushes everything to https.


You can't send redirects without a vlid certificate. The redirect is done in either the HTTP protocol by returning a 301 or 302 response, or in html content with a meta header. For this data to be sent, the SSL connection needs to be set up first, with a valid certificate. So don't be ridiculously cheap and get an almost-free startssl certificate for the .com.

And if you don't want to point that domain to a separate IP, you need to set up SNI support in apache to deal with multiple certs on one IP.

| improve this answer | |
  • OK, this is what I thought. It's not me being cheap, I just don't want to recommend purchases that aren't required. Assumedly I can do that at DNS level without issue? – Rich Bradshaw Jun 15 '13 at 10:23
  • You can't do redirects at DNS level. What you do at DNS level is just tell browsers what IP they need to contact for your .com domain, and this can be of course the same IP as your .co.uk domain. But you will still need a certificate for you .com domain. The only thing that changes is what server you will have to install it on. – Krist van Besien Jun 21 '13 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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