Forcing HTTPS gives "Too Many Redirects"

  • Hey,


    I tried to force HTTPS myself but it didn't work, after that lookin into the .htaccess I saw they have there own setup for it.

    I enabled it by uncommeting it and I got a error "Too many redirects".


    I commented this:

    Code
    1. # Redirect requests to access the site with HTTPS
    2. # RewriteCond %{HTTPS} off
    3. # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
  • I know this is an old thread, but just in case someone else has a similar issue that can't be solved by modifying the file supplied by Pagekit, I'd suggest that you'd use the following code and place it at the very top of your .htaccess file (assuming that you already have one in place, and can use it in your environment).


    Code
    1. # force ssl
    2. <IfModule mod_rewrite.c>
    3. RewriteEngine On
    4. RewriteCond %{HTTPS} !=on
    5. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    6. </IfModule>

    This code should work on any domain or subdomain, or with pagekit installed and running in a subdirectory. The only requirement is that you have a valid SSL cert in place and working. If you can't use a web address using "https://" to view a real page, then this code block will not help you at all.