I don't know how to to this with a single file...I've never really had a need to. However to secure a single directory is easy. First you need to configure apache to listen for
http:// and
https://. Then, in the directory that you would like to use ssl, create a .htaccess file and use a RewriteRule.
.htaccess
-----------------------------------------------------------
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*)
https://www.yoursite.com/ [R]
-----------------------------------------------------------