I cannot seem to find an answer to this. I have given a thorough search. I have WAMP set up locally and to access it, I type the URL like so:
my-site/
Then when I push the files to Heroku, I access the site like:
my-site.herokuapp.com
I need to force pages to load on https in Heroku. The htaccess for this works fine on Heroku, but breaks my local WAMP environment.
I've been trying to set two Rewrite Conditions and chain them together so that the htaccess only applies on Heroku and is ignored locally. Here is what my htaccess looks like:
RewriteEngine On
##Force SSL
#only if herokuappis found in the url
RewriteCond %{HTTP_HOST} ^herokuapp$
#Heroku way
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I borrowed the code from here. How to redirect to HTTPS with .htaccess on Heroku Cedar stack
and have been trying to modify it to work for me, but to no avail.
I've even tried other variations to detect heroku in the URL such as:
RewriteCond %{QUERY_STRING} heroku
or
RewriteCond %{REQUEST_URI} heroku
But I may be misunderstanding how those are used. I am just trying to match two conditions, but honestly, if I could do it with one that would be fine too. If I could simply force HTTPS any time the URL has heroku in it, that would also work.
Thanks in advance.
EDIT: When I load the site on local I get
This site can’t be reached my-site refused to connect.
Try:Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED