On Tue, Sep 29, 2015 at 6:19 PM, K R <kp0...@gmail.com> wrote:

> I am trying to force redirect HTTP to HTTPS  as below
>
> RewriteEngine On
> RewriteCond %{HTTPS} !=on
> RewriteRule ^/?(.*)  https://%{SERVER_NAME}/$1 [R,L]
>
> but it fails with too many redirect error .
>

Did you google "apache https redirect"? The second result (for me anyway)
is to

http://httpd.apache.org/docs/2.4/rewrite/avoid.html

which explains why you shouldn't use mod_rewrite for this. See also

https://wiki.apache.org/httpd/RedirectSSL

Having said that I don't see anything obviously wrong with what you showed
us other than you probably should be using %{HTTP_HOST} and the RewriteRule
statement is needlessly complicated (but then so are most of the examples I
saw from the google search recommended).

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Reply via email to