Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 : url() function to return "https" urls?

I'm using Laravel 5.2. Below is one example of url() usage in one of my view (blade) file:

<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
..
..
</form>

It returns me non-https urls like: http://www.example.com/register

I need it to be HTTPS. I'm already using valid HTTPS on my Website.

In my .env file, it is already:
APP_URL=https://www.example.com

In my config/app.php, it is already:
'url' => env('APP_URL', 'https://www.example.com'),

So what else do i need to configure for the LV 5.2 to return the HTTPS urls via url() helper function please?

Thank you.

like image 689
夏期劇場 Avatar asked Sep 05 '25 03:09

夏期劇場


1 Answers

Instead of url() you can simply use secure_url()

<form class="form-horizontal" role="form" method="POST" action="{{ secure_url('/register') }}">
..
..
</form>
like image 180
Nicklas Kevin Frank Avatar answered Sep 08 '25 01:09

Nicklas Kevin Frank