doujunchi1238 2016-08-02 23:27
浏览 31
已采纳

Symfony 3无法找到我的.svg图标

I have recently installed symfony 3 on a fresh Ubuntu server, I was previously using WAMP to run my symfony website but now I have migrated.

Everything is up and running except on one of my pages I have some .svg icons to show the weather. These icons are getting a 404 error.

I have made sure they are in the correct location and I havent changed any of the html that links to them from the windows version which works fine.

They are located in web>icons>weather

My img tag <img src="icons/weather/{{ item.icon }}.svg" /> item.icon is using twig to grab from my weather rss feed.

That outputs GET http://192.168.0.53/icons/weather/cloud.svg 404 (Not Found) in inspect and I cannot access it by going to that url manually.

Is there a .htaccess problem which causes my images to not be located correctly?

  • 写回答

2条回答 默认 最新

  • dpjs2005 2016-08-06 14:03
    关注

    Alright, I found the answer.

    I had a thought (like the one in my comment) that Symfony might be looking for/use a folder named "icons" in the web folder in its own way.

    Whether this is the case or not I don't know but I moved the icons into a vendor folder. The address is now vendor/icons/weather/cloud.svg and IT WORKS!

    So I guess what we can learn from this is either its a stupid error from me which I still don't know about or you can't use a folder called "icons" in the web folder.

    Thanks for you help Alvin

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器