I did some googling and found this solution:
Code:
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
Use that in your .htaccess file. That will rewrite everything in that directory to start with
https:// but otherwise remain the same. Works perfectly when I try it, even with in subdirectories etc. without changes. Just put that by itself in your .htaccess file in the dir you want to protect by forcing SSL-only access and then test it.
[edit]I should give credit to this webpage:
http://list.cobalt.com/pipermail/cob...er/033818.html for the solution above. The first example shown is what I used, but I modified it first to eliminate the RewriteBase command which I found was not needed (by process of elimination) and I also found that I could use the REQUEST_URI environment variable like I do in CGI scripts to insert whatever document path and name was requested, whereas the original example on that page had you changing the directory. I'd much rather have something that you just drop in and works rather than having to change it depending on what directory you happen to put it in! You may want to try the version on the linked page if mine doesn't work on your hosting provider, since your host may set different environment variables or set them differently than mine (which is
http://www.bluevirtual.com).[/edit]