symfony /css /images sub folder files not viewable on production

I get a 404 error when trying to access css/style.css or images/image.png in production on live server, however these work locally. I believe it maybe due to the folder location in web/css folder of project. I don’t use assetic management or other apart from with js which works for /js/jsfile.js with assetic dump. Css never seemed to work for me so I previously referenced the bundle folder directly, but now just want to use /css or /images

<img src="{{asset('/images/image.png')}}"

I tried this in .htaccess in the route of the project folder but this doesn’t work

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On        
RewriteRule ^subfolder/web/app.php - [L]    
RewriteCond %{REQUEST_FILENAME} !-f    
RewriteRule ^(.*)$ subfolder/web/app.php [QSA,L]
RewriteRule ^robots.txt [L]
# For all URL starting with /css,/img 
# RewriteCond %{REQUEST_URI} ^/?(css|images|fonts)(/.*)?$ [NC]
# RewriteRule ^(.*)$ subfolder/web/%1%2 [L]
</IfModule>

Any ideas appreciated.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *