I\'m new to cloud hosting...
I\'m working on a PHP web app that\'s hosted on Heroku as a \"Cedar\" app. Heroku offers \"piggy back\" SSL to all their subdomains, so
I added one line to the great answer given above so it doesn't break my local dev environment which doesn't have SSL configured:
# If header is present in the request RewriteCond %{HTTP:X-Forwarded-Proto} .
(Note RewriteRule is applied only if all preceeding RewriteCond's hold).