Ever wanted to enforce HTTPS access to particular scripts or files? Here’s one way to do it. The following Apache example rewrites URL to HTTPS for .html, .htm, and .php files.
<IfModule mod_rewrite.c>
<FilesMatch "\.(htm|html|php)$">
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</FilesMatch>
</IfModule>