user11056335
user11056335

Reputation:

Symfony4 is there any way to get my Domain Name?

I know i can get a lot of informations about the HTTP request by doing $request->getSomething, but I didn't find anything anywhere to get my domain name.

I need it for mailing, when i click on links in mails <a href="{{ path('lesseeRegistration', {'invitationToken': invitationToken}) }}" target="_blank">ici</a>, I'm redirected to http://myRoute, and I want to be redirect to http://myDomainName/myRoute. Of course I could cheat by writting staticly my domain name, but I would like solve my problem by a better way

Thanks for your help :)

Upvotes: 1

Views: 275

Answers (1)

G1.3
G1.3

Reputation: 1879

You only need to get an absolute URL. There is a twig function url. Doc here

You use it like the path function:

<a href="{{ url('lesseeRegistration', {'invitationToken': invitationToken}) }}" target="_blank">ici</a>

Upvotes: 1

Related Questions