I want to redirect all HTTP requests to HTTPS as well as redirect all www requests to non-www.

The reason for this is that I want SSL to be forced and I am currently unable to support SSL on my www subdomain.

This solution needs to support all combinations of HTTP, HTTPS, www and non-www. The best solutions I have found so far supports all combinations except www and HTTPS at the same time.

Thank you for your time. :)

EDIT: Just to explicitly state it once again, to avoid any more incorrect duplication suggestion: I want to redirect from www to non-www not the other way around. I also want to force SSL at the same time.

  • "except www and HTTPS at the same time" - You won't be able to redirect www and HTTPS if your certificate does not support this. That's the point of the SSL cert - it kicks in before everything else, so you'll get the cert warning before your site is able to deal with the request.
    – MrWhite
    Commented Sep 11, 2015 at 23:51
  • So what if I redirect to non-www and THEN to SSL? And in some way exclude www from even using the certificate in the first place? Commented Sep 11, 2015 at 23:57
  • I have an example of what you are asking for here: webmasters.stackexchange.com/questions/72317/…
    – closetnoc
    Commented Sep 12, 2015 at 0:00
  • Although the problem you state is if somebody navigates to https://www.example.com - unless your cert supports the www subdomain then you can't redirect anything in this instance. Otherwise you can use the existing solutions.
    – MrWhite
    Commented Sep 12, 2015 at 0:02


Browse other questions tagged or ask your own question.