Get "PHP 8 in a Nuthshell" (Now with PHP 8.4)
Amit Merchant

Amit Merchant

A blog on PHP, JavaScript, and more

Force HTTPS for all the URLs in Laravel

Here’s how you can do it using the URL::forceHttps() method.

Set this in your app’s boot() method of the service provider.

use Illuminate\Support\Facades\URL;

URL::forceHttps(app()->isProduction());

Was that useful? Consider leaving a

Tip

👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.

Comments?