Forcing http using .htaccess

You want to check that HTTPS is on:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

And if it is on (%{HTTPS} on), redirect to http://. There is no mod_rewrite variable called %{HTTP}, only %{HTTPS} which can be "on" or "off".

The reason why you were getting the too many redirects error is because:

RewriteCond %{HTTP} !=on

is always true no matter if the request is http or https, since the variable doesn't exist, it will never be equal to "on". Therefore, even if the request is http, you keep getting redirected to the same URL (http).

Tags:

Php

.Htaccess