I made a .htaccess to redirect http requests to https. However my local testing server does not support https so I need to redirect only when the hostname does not match a given one:
RewriteCond %{HTTPS} != on
RewriteCond %{HTTP_HOST} != localhost [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301]
The problem is that it redirects to https in every situations. Do you have any idea on why it acts like this ?