Laravel 5.3 Html link adding www on the url


When i run the command

Html::link( $subCategory->url, ucfirst($categoryName) , ['alt' => ucfirst($subCategory->nome), 'title' => ucfirst($subCategory->nome)] )

the laravel create url to a product.

The problem: In some cases the HTML::LINk create the url without www: (default)
In outher cases the HTML::link create with www: (adding www )

1 ) Why the laravel Html::link add www only in some cases ?

2 ) Can I choose to use urls only without the WWW?

3 ) Do you have any idea why the session is lost when this url exchange happens ?

I know it happens because it loses the session of the site that it authenticated, it is usually the website without www in the url. But when the client browses the menu and finds a url with www the session is lost.

Laravel 5.3

Show source
| url   | laravel   | php   | laravel-5.3   2017-01-05 20:01 1 Answers

Answers ( 1 )

  1. 2017-01-05 21:01

    Then link() translates first parameter to url it seems you have differ values in your database $subCategory->url

    yes session gets lost when your app changes its protcol

    alternatively you can create it manually like this

    <a href='{{url($subCategory->url)}}' alt='{{ucfirst($subCategory->nome)}}' title='{{ucfirst($subCategory->nome)}}'>{{ucfirst($categoryName)}}</a>

◀ Go back