Symfony Get Base Url

[Solved] Symfony Get Base Url | Php Frameworks Symfony - Code Explorer | yomemimo.com
Question : symfony get base url

Answered by : amused-anteater-n44zkia3uizm

This is now available for free in twig templates (tested on sf2 version 2.0.14)
{{ app.request.getBaseURL() }}
In later Symfony versions (tested on 2.5), try :
{{ app.request.getSchemeAndHttpHost() }}

Source : https://stackoverflow.com/questions/6840578/getting-the-base-url-of-the-website-and-globally-passing-it-to-twig-in-symfony-2 | Last Update : Tue, 22 Jun 21

Answers related to symfony get base url

Code Explorer Popular Question For Php Frameworks Symfony