Symfony2 & CSS url References.

I was having problems when designing my website, i was linking to images and then on the development enviroment i wasn’t able to see them.

For example, when working on localhost/website/web/app_dev.php and you have something like this:

.someDiv {
   background: url(images/logo.png) no-repeat;

The browser would search for localhost/website/web/app_dev.php/images/logo.png which would throw a 404.

So after trying to find out the “correct” way of solving this, i just said: -fuck it, just do it- and i edited the file app.php in the web directory and added this at the very begining of the file (i would remove when going to production):



include "app_dev.php";

require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('prod', false);

it get the job done and doesn’t make you lose time trying to figure out anything weird.
If someone knows the correct way of solving this, please let me know.