phpsymfonytwigsymfony-2.6

Symfony 2 : Web debug tool bar not showing (404 error) and Twig path function's not working


I have built a symfony 2.6 web site and I deploy it in an url like this :

https://www.example.com/abc/

This url points on the "web" directory (as the root directory).

The web site is working fine, but there is two issues :

1) Web debug tool bar is not showing because the widget is pointing on https://www.example.com/ not on https://www.example.com/abc/ and I don't understand why ?!

2) Same thing for Twig path() function, it is also pointing on https://www.example.com/ not https://www.example.com/abc/

So do you have any idea about that ?


Solution

  • I Finally Got it, "abc" is not a physical folder it's just a "virtual" path defined in the virtual host of www.example.com, so while https://www.example.com/abc/ is pointing on web folder of my symfony project, which is the root repository by default in Symfony framework, the folder "abc" doesn't exist in reality, In fact I use to modify in this script "/public_html/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php" this way by enforcing the "/abc" part in the dynamically

    generated url :

    $url = $schemeAuthority."/abc".$this->context->getBaseUrl().$url;

    I think Symfony doesn't take this case into account by default.

    Other thing that can cause this issue too is to verify the scheme (http or https) of your website in the routing configuration (routing.yml) of your project, example :

    test:

    resource: "@testBundle/Controller/"
    
    type:     annotation
    
    prefix:   /
    
    schemes:  [http]