Fontawesome fonts fail after assets:install and assetic:dump

前端 未结 5 532
醉话见心
醉话见心 2021-01-06 11:05

I\'m trying to setting up a site I\'m working on at shared hosting and all works fine but FontAwesome icons since Symfony does not find them where they should be. I follow t

5条回答
  •  盖世英雄少女心
    2021-01-06 11:28

    I had a similar problem while trying to use fonts with an Ez Publish setup. The fonts were correctly located in the web/font/ directory and the .less was correctly compiled to point to that directory. Yet, I was getting 404 errors while trying to pull the font files.

    The problem turned out to be an incorrectly configured virtual host. The config file had this line:

    RewriteRule ^/(css|js)/.*\.(css|js) - [L]

    Which effectively states 'serve any file from the css or js folder as long as the extension is .js or .css'. I had to modify it to

    RewriteRule ^/(css|js|font)/.*\.w* - [L]

    to allow for the font folder and any extension. Without this Symfony and Ez Publish were trying to route the url to a dynamic content.

提交回复
热议问题