This question already has an answer here:
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.