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 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入