g1smd - 1:08 pm on Mar 25, 2013 (gmt 0) [edited by: g1smd at 1:24 pm (utc) on Mar 25, 2013]
Late to the conversation, but an explanation of what your original htaccess does, and its limitations is in order...
The original code redirects:
- http index.html (but not index.php) requests to http, www and "/"
- https index.html (but not index.php) requests to https, www and "/"
- http requests for any hostname other than exactly www.example.com to http and www
- https requests for any hostname other than exactly www.example.com to https and www
This code is good, essential even, however there is nothing in there to force any particular page, using the URL format in your example, to be http or https. You should also add provision for .php to the index redirects.
There is a rule to redirect requests for example.com/file.php/something and example.com/folder/file.php/something to http (and the same for .htm/ and .html/ requests), but the pattern in that rule doesn't match your example URLs.
The usual method is to have www.example.com as http and store.example.com as https, or to define certain folders as https and the rest of the site as http. In your case, unless there's a simple rule you can add to the htaccess to take care of this, it is probably better to do the checking and redirecting from within your PHP script.
The rules should also change order: 1 - 2 - 3 - 4 - 5 should be 1 - 2 - 5 - 3 - 4.
[edited by: g1smd at 1:24 pm (utc) on Mar 25, 2013]