Search code examples
laravelsslhttpsroot

Changing root directory and forcing https


I'm trying to change root directory of my Laravel application and fore https all over website. This is my .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Point to public folder
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]

    # Force https
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

It changes root directory, but it doesn't force https. If I do it another way, first forcing https then set to root directory, then I get too many redirects

EDIT Solution was to change settings in my Cloudflare . Cloudflare -> 'Crypto' tab -> SSL to 'Strict'


Solution

  • Solution was to change settings in my Cloudflare . Cloudflare -> 'Crypto' tab -> SSL to 'Strict'