The scenario is that I have an SSL certificate for my domain and I want to redirect users to https://www.mydomain.com regardless of whether they include http or www in the url.
I got it working after some Googling and trial and error but I’d appreciate it if anyone could explain to me why this works:
A request for http://www.mydomain.com does not meet the first condition, a request for https://mydomain.com does not meet the second condition, so neither of them will be redirected.
To get what you want, you need an [OR] between those conditions.
Cheers for that David - as you can probably tell I’m new to this so your help is much appreciated! I’ve implemented your code successfully. I guess that using the OR flag is preferable to having the two separate rewrite rules as it means that my code is simpler and faster (although the difference is no doubt negligible) - and it also means that future changes will be easier to implement.
No sweat, Billy. If you need more information, you might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.