SSL Redirect Loop

When editing the .htaccess file to force https access I’m getting a redirect loop.

Enable this to enforce https access

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

Here is the complete .htaccess file

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Enable this to enforce https access
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

</IfModule>

Another way to force SSL is to add REQUIRE_HTTPS=true to the .env file in the root folder of the project.

Thanks for your assistance,

I added that option in the .env file

But now when accessing the site it sends me to /public/public instead of the correct /public/dashboard
with the message “Sorry, the page you are looking for could not be found.”

Try changing line 37 in app/Http/Middleware/StartupCheck.php from

return Redirect::secure(Request::getRequestUri());

To

return Redirect::secure(Request::path());

Thanks so much for the suggestion it worked.

Thanks for letting us know, we’ll include this change with our next release.