Laravel: how to force HTTPS?
Try adding this code in your .htaccess file.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
When you want to Render all URLs with https the simplest method is to
use the code below in the boot()
function of app/Providers/AppServiceProvider.php
:
\URL::forceScheme('https');
You need adding this to your .htaccess
file:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://YOURWEBSITEDOMAIN/$1 [R,L]
See this: http://www.inmotionhosting.com/support/website/ssl/how-to-force-https-using-the-htaccess-file