Force SSL

I think I’m missing some function to force the site to be only displayed via https.
I tried it with the common rewrite rule, but it does not work:

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

Any tipps?

there is some incompatibility with my rule to force https and this default .htaccess Rule:
RewriteRule .* index.php [L]

Any way to redirect all non https traffic to https and still redirect all to the index.php?

RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=302,L]

This is what I use on getgrav.org

1 Like

osm! thx rhukster.