DEV Community

Ishaan Sheikh
Ishaan Sheikh

Posted on

How to force HTTPS in Laravel

To force your website to load with HTTPS in Laravel you can add the following code in your route/web.php file.


use Illuminate\Support\Facades\URL;

if(env('APP_ENV') == "production"){

// Your routes here

Enter fullscreen mode Exit fullscreen mode

It is a one of doing it, of course there are other ways to do so. You can add one in the comments below.

Oldest comments (0)