Ok, I seem to be doing this halfway correctly, so please let me know what you think. I am using all this in my .htaccess, and I'm unsure if it's overkill or will create problems later:
Code:
# This rewrites URLs to force https on all requests to whmcs
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/dl.php [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/dl.php [NC]
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ $1 [R,L]
The first 3 sections are a combination of what you wrote above on this thread. The 4th section is what I added, and it comes from a WordPress blog htaccess section that I also use SSL on -- this seems to more accurately force the https on the URLs.
Does the above seem correct?