title: How to force Heroku PHP app to use SSL certificate (https)?
body: <p>I am trying to force my heroku web app to use the automatic certificate offered from heroku. I need to force all my links to use https. So I added lines:</p>
  <pre><code>RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  <p>To the htaccess file, but now I get the error &quot;This page isn't working, too many redirects&quot;. What do I put in my htaccess file to force https? Everyone online I've found uses this, but if I delete my other rules my website does not load.</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  &lt;IfModule mod_negotiation.c&gt;
      Options -MultiViews -Indexes
  &lt;/IfModule&gt;
  
  RewriteEngine On
  
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
  # Handle Authorization Header
  RewriteCond %{HTTP:Authorization} .
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
  # Redirect Trailing Slashes If Not A Folder...
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} (.+)/$
  RewriteRule ^ %1 [L,R=301]
  
  # Handle Front Controller...
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]
  </code></pre>