I am working on a project that requires a secure connection.
I can set the route, uri, asset to use \'https\' via:
Route::get(\'order/details/{id}\',
You can set 'url' => 'https://youDomain.com'
in config/app.php
or you could use a middleware class Laravel 5 - redirect to HTTPS.
Place this in the AppServiceProvider in the boot() method
if($this->app->environment('production')) {
\URL::forceScheme('https');
}
Add this to your .htaccess code
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Replace www.yourdomain.com with your domain name. This will force all the urls of your domain to use https. Make sure you have https certificate installed and configured on your domain. If you do not see https in green as secure, press f12 on chrome and fix all the mixed errors in the console tab.
Hope this helps!
try this - it will work in RouteServiceProvider file
$url = \Request::url();
$check = strstr($url,"http://");
if($check)
{
$newUrl = str_replace("http","https",$url);
header("Location:".$newUrl);
}