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

我的未来我决定 提交于 2020-04-17 22:54:56

问题


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.

来源:https://stackoverflow.com/questions/59439064/symfony-css-images-sub-folder-files-not-viewable-on-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!