I have a site: mydomain.com for example I want to redirect mydomain.com to www.mydomain.com for all request. I am using this code: However, my SSL certificate is on mydomain.com My site is a zen-cart site, and when people logs in, it kicks in the SSL mode, which means using mydomain.com instead of www.mydomain.com. This is causing an error, because the site wants to use https://mydomain.com for SSL matters, while the .htaccess wants to convert to www. Any suggestions for the redirect using the code previously mentionned in .htaccess applys only when not in SSL ?