If I go to this URI
/app_dev.php/css/eabd201_jquery.ui.theme_15.css
it gives me that CSS file, which is what I would expect, but if I go to this URI,
/app_dev.php/css/images/ui-icons_222222_256x240.png
I get this error:
No route found for “GET /css/images/ui-icons_222222_256x240.png”
It seems like there must be a way to tell Symfony not to try to go through routing for /css/* paths. (I know the file exists.) How might I do that?
Edit: here’s my .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I don’t know if it’s exactly your case but imagine the directory structure:
In
style.css, as soon as you are referencing your images using relative paths likeurl(../images/foo.png), so it can’t work if you movestyle.cssinto another directory.You’re using Assetic to render your CSS files so assetic “moves” this CSS file into the
/app_dev.php/cssdirectory which does not really exist and is handled by theapp_dev.phpcontroller. So now, the relative path to the image does not point to the image but to/app_dev.php/images/foo.pngwhich also does not really exist and is handled by theapp_dev.phpcontroller.Hopefully it’s a really common problem and there is a built-in solution: the
cssrewritefilter.You can either add it to your
{% stylesheet %}tags:Or apply it to every CSS file:
It will take care of rewriting this kind of paths for your.