I have a symlink from /var/www/web/ to /projects/Symfony/web/. When trying to access my site with app_dev.php (ie. http://localhost/web/app_dev.php), CSS is linked wrongly (...web/app_dev.php/css/styles.css). BUt when accessing app.php (non development mode), its OK. So how can I fix this?
htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
Try to include your stylesheets using asset() twig function:
It should take care of creating proper links.
If you use PHP templates try:
Read more about assets in Including Stylesheets and Javascripts in Twig and about PHP templates in How to use PHP instead of Twig for Templates.