Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a 301 set up which redirects http://domain.com to http://www.domain.com (http://www.domain.com$S$Q) but if I browse to https://domain.com I get an SSL error (as it expects www.domain.com).

Is there any way to make it redirect before the browser throws a cert error?

share|improve this question

migrated from stackoverflow.com Sep 12 '09 at 1:42

This question came from our site for professional and enthusiast programmers.

    
isn't the cert bound to www.domain.com, therefore using the cert on domain.com is seen as a violation? I dunno, its how I always thought it was... –  Will Mar 29 '09 at 17:03
    
Yes. I was hoping to have it redirect the user to www.domain.com before caring about the domain.com cert. As Brad says, this isn't possible. –  Mr. Flibble Mar 29 '09 at 19:25
add comment

2 Answers

up vote 6 down vote accepted

Yes, but not how you think.

  • You will need a valid certificate for domain.com
  • You will need domain.com and www.domain.com to have separate public IP addresses

If you can't do that, you're out of luck, unfortunately. You can't use HOST headers to differentiate between the two requests, because that's far too late (thus, separate IP addresses). And unless you have a valid certificate, the browser is going to choke, so you also need the 2nd cert.

There's no way around these requirements, I'm afraid.

share|improve this answer
add comment

There is a way round it. You can get a single cert for both www.domain.com and domain.com. Then you can use a regular redirect. These multi-domain certificates are generally more expensive though.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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