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