夏期劇場
夏期劇場

Reputation: 18337

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.

Upvotes: 4

Views: 3800

Answers (1)

Nicklas Kevin Frank
Nicklas Kevin Frank

Reputation: 6337

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

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

Upvotes: 9

Related Questions